com.android.dex.FieldId Java Examples

The following examples show how to use com.android.dex.FieldId. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FieldInfo.java    From Box with Apache License 2.0 5 votes vote down vote up
public static FieldInfo fromDex(DexNode dex, int index) {
	FieldId field = dex.getFieldId(index);
	return from(dex,
			ClassInfo.fromDex(dex, field.getDeclaringClassIndex()),
			dex.getString(field.getNameIndex()),
			dex.getType(field.getTypeIndex()));
}
 
Example #2
Source File: IndexMap.java    From Box with Apache License 2.0 5 votes vote down vote up
public FieldId adjust(FieldId fieldId) {
    return new FieldId(target,
            adjustType(fieldId.getDeclaringClassIndex()),
            adjustType(fieldId.getTypeIndex()),
            adjustString(fieldId.getNameIndex()));

}
 
Example #3
Source File: FindUsages.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the fields with {@code memberNameIndex} declared by {@code
 * declaringType}.
 */
private Set<Integer> getFieldIds(Dex dex, Set<Integer> memberNameIndexes, int declaringType) {
    Set<Integer> fields = new HashSet<Integer>();
    int fieldIndex = 0;
    for (FieldId fieldId : dex.fieldIds()) {
        if (memberNameIndexes.contains(fieldId.getNameIndex())
                && declaringType == fieldId.getDeclaringClassIndex()) {
            fields.add(fieldIndex);
        }
        fieldIndex++;
    }
    return fields;
}
 
Example #4
Source File: DexIndexPrinter.java    From Box with Apache License 2.0 5 votes vote down vote up
private void printFieldIds() throws IOException {
    int index = 0;
    for (FieldId fieldId : dex.fieldIds()) {
        System.out.println("field " + index + ": " + fieldId);
        index++;
    }
}
 
Example #5
Source File: FieldInfo.java    From Box with Apache License 2.0 5 votes vote down vote up
public static FieldInfo fromDex(DexNode dex, int index) {
	FieldId field = dex.getFieldId(index);
	return from(dex,
			ClassInfo.fromDex(dex, field.getDeclaringClassIndex()),
			dex.getString(field.getNameIndex()),
			dex.getType(field.getTypeIndex()));
}
 
Example #6
Source File: IndexMap.java    From Box with Apache License 2.0 5 votes vote down vote up
public FieldId adjust(FieldId fieldId) {
    return new FieldId(target,
            adjustType(fieldId.getDeclaringClassIndex()),
            adjustType(fieldId.getTypeIndex()),
            adjustString(fieldId.getNameIndex()));

}
 
Example #7
Source File: FindUsages.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the fields with {@code memberNameIndex} declared by {@code
 * declaringType}.
 */
private Set<Integer> getFieldIds(Dex dex, Set<Integer> memberNameIndexes, int declaringType) {
    Set<Integer> fields = new HashSet<Integer>();
    int fieldIndex = 0;
    for (FieldId fieldId : dex.fieldIds()) {
        if (memberNameIndexes.contains(fieldId.getNameIndex())
                && declaringType == fieldId.getDeclaringClassIndex()) {
            fields.add(fieldIndex);
        }
        fieldIndex++;
    }
    return fields;
}
 
Example #8
Source File: DexIndexPrinter.java    From Box with Apache License 2.0 5 votes vote down vote up
private void printFieldIds() throws IOException {
    int index = 0;
    for (FieldId fieldId : dex.fieldIds()) {
        System.out.println("field " + index + ": " + fieldId);
        index++;
    }
}
 
Example #9
Source File: DexLimitTracker.java    From bazel with Apache License 2.0 5 votes vote down vote up
static FieldDescriptor fromDex(Dex dex, int fieldIndex) {
  FieldId field = dex.fieldIds().get(fieldIndex);
  String name = dex.strings().get(field.getNameIndex());
  String declaringClass = typeName(dex, field.getDeclaringClassIndex());
  String type = typeName(dex, field.getTypeIndex());
  return new AutoValue_DexLimitTracker_FieldDescriptor(declaringClass, name, type);
}
 
Example #10
Source File: IndexMap.java    From buck with Apache License 2.0 5 votes vote down vote up
public FieldId adjust(FieldId fieldId) {
    return new FieldId(target,
            adjustType(fieldId.getDeclaringClassIndex()),
            adjustType(fieldId.getTypeIndex()),
            adjustString(fieldId.getNameIndex()));

}
 
Example #11
Source File: FindUsages.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the fields with {@code memberNameIndex} declared by {@code
 * declaringType}.
 */
private Set<Integer> getFieldIds(Dex dex, Set<Integer> memberNameIndexes, int declaringType) {
    Set<Integer> fields = new HashSet<Integer>();
    int fieldIndex = 0;
    for (FieldId fieldId : dex.fieldIds()) {
        if (memberNameIndexes.contains(fieldId.getNameIndex())
                && declaringType == fieldId.getDeclaringClassIndex()) {
            fields.add(fieldIndex);
        }
        fieldIndex++;
    }
    return fields;
}
 
Example #12
Source File: DexIndexPrinter.java    From buck with Apache License 2.0 5 votes vote down vote up
private void printFieldIds() throws IOException {
    int index = 0;
    for (FieldId fieldId : dex.fieldIds()) {
        System.out.println("field " + index + ": " + fieldId);
        index++;
    }
}
 
Example #13
Source File: DexNode.java    From Box with Apache License 2.0 4 votes vote down vote up
public FieldId getFieldId(int fieldIndex) {
	return dexBuf.fieldIds().get(fieldIndex);
}
 
Example #14
Source File: DexNode.java    From Box with Apache License 2.0 4 votes vote down vote up
public FieldId getFieldId(int fieldIndex) {
	return dexBuf.fieldIds().get(fieldIndex);
}