本文整理汇总了Java中org.jf.dexlib2.iface.reference.FieldReference类的典型用法代码示例。如果您正苦于以下问题:Java FieldReference类的具体用法?Java FieldReference怎么用?Java FieldReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldReference类属于org.jf.dexlib2.iface.reference包,在下文中一共展示了FieldReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeFieldDescriptor
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
public static void writeFieldDescriptor(Writer writer, FieldReference fieldReference,
boolean implicitReference) throws IOException {
if (!implicitReference) {
String clazz = fieldReference.getDefiningClass();
if (DexDiffInfo.getModifiedClasses(clazz) != null) {
if (isStaticFiled(DexDiffInfo.getModifiedClasses(clazz), fieldReference)) {//静态变量要访问以前的
} else {
clazz = TypeGenUtil.newType(clazz);
}
}
writer.write(clazz);
writer.write("->");
}
writer.write(fieldReference.getName());
writer.write(':');
writer.write(fieldReference.getType());
}
开发者ID:alibaba,项目名称:atlas,代码行数:18,代码来源:ReferenceUtil.java
示例2: writeReference
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
public static void writeReference(IndentingWriter writer, int referenceType,
Reference reference) throws IOException {
switch (referenceType) {
case ReferenceType.STRING:
writeStringReference(writer, ((StringReference)reference).getString());
return;
case ReferenceType.TYPE:
writer.write(((TypeReference)reference).getType());
return;
case ReferenceType.METHOD:
ReferenceUtil.writeMethodDescriptor(writer, (MethodReference) reference);
return;
case ReferenceType.FIELD:
ReferenceUtil.writeFieldDescriptor(writer, (FieldReference)reference);
return;
default:
throw new IllegalStateException("Unknown reference type");
}
}
开发者ID:alibaba,项目名称:atlas,代码行数:20,代码来源:ReferenceFormatter.java
示例3: getNextFieldOffset
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
private int getNextFieldOffset() {
SparseArray<FieldReference> instanceFields = getInstanceFields();
if (instanceFields.size() == 0) {
return 8;
}
int lastItemIndex = instanceFields.size()-1;
int fieldOffset = instanceFields.keyAt(lastItemIndex);
FieldReference lastField = instanceFields.valueAt(lastItemIndex);
switch (lastField.getType().charAt(0)) {
case 'J':
case 'D':
return fieldOffset + 8;
default:
return fieldOffset + 4;
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:19,代码来源:ClassProto.java
示例4: jimplify
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
public void jimplify (DexBody body) {
TwoRegisterInstruction i = (TwoRegisterInstruction)instruction;
int dest = i.getRegisterA();
int object = i.getRegisterB();
FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
InstanceFieldRef r = Jimple.v().newInstanceFieldRef(body.getRegisterLocal(object),
getSootFieldRef(f));
assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), r);
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
int op = (int)instruction.getOpcode().value;
DalvikTyper.v().setType(assign.getLeftOpBox(), r.getType(), false);
}
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:IgetInstruction.java
示例5: jimplify
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
public void jimplify (DexBody body) {
int source = ((OneRegisterInstruction)instruction).getRegisterA();
FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
StaticFieldRef instanceField = Jimple.v().newStaticFieldRef(getStaticSootFieldRef(f));
Local sourceValue = body.getRegisterLocal(source);
assign = getAssignStmt(body, sourceValue, instanceField);
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
int op = (int)instruction.getOpcode().value;
DalvikTyper.v().setType(assign.getRightOpBox(), instanceField.getType(), true);
}
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:17,代码来源:SputInstruction.java
示例6: jimplify
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
public void jimplify (DexBody body) {
TwoRegisterInstruction i = (TwoRegisterInstruction)instruction;
int source = i.getRegisterA();
int object = i.getRegisterB();
FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference();
InstanceFieldRef instanceField = Jimple.v().newInstanceFieldRef(body.getRegisterLocal(object),
getSootFieldRef(f));
Local sourceValue = body.getRegisterLocal(source);
assign = getAssignStmt(body, sourceValue, instanceField);
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
int op = (int)instruction.getOpcode().value;
DalvikTyper.v().setType(assign.getRightOpBox(), instanceField.getType(), true);
}
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:20,代码来源:IputInstruction.java
示例7: getNextFieldOffset
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
private int getNextFieldOffset() {
SparseArray<FieldReference> instanceFields = getInstanceFields();
if (instanceFields.size() == 0) {
return classPath.isArt() ? 0 : 8;
}
int lastItemIndex = instanceFields.size()-1;
int fieldOffset = instanceFields.keyAt(lastItemIndex);
FieldReference lastField = instanceFields.valueAt(lastItemIndex);
if (classPath.isArt()) {
return fieldOffset + getTypeSize(lastField.getType().charAt(0));
} else {
switch (lastField.getType().charAt(0)) {
case 'J':
case 'D':
return fieldOffset + 8;
default:
return fieldOffset + 4;
}
}
}
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:ClassProto.java
示例8: analyze
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
private void analyze(@Nonnull DexBackedMethodImplementation implementation) {
cyclomaticComplexity = calculateComplexity(implementation);
registerCount = implementation.getRegisterCount();
tryCatchCount = implementation.getTryBlocks().size();
debugItemCount = Utils.makeCollection(implementation.getDebugItems()).size();
for (Instruction instruction : implementation.getInstructions()) {
instructionCount++;
Opcode op = instruction.getOpcode();
opCounts.adjustOrPutValue(op, 1, 1);
if (instruction instanceof ReferenceInstruction) {
ReferenceInstruction refInstr = (ReferenceInstruction) instruction;
switch (op.referenceType) {
case ReferenceType.METHOD:
MethodReference methodRef = (MethodReference) refInstr.getReference();
if (fullMethodSignatures) {
apiCounts.adjustOrPutValue(methodRef, 1, 1);
} else {
ShortMethodReference shortMethodRef = new ShortMethodReference(methodRef);
apiCounts.adjustOrPutValue(shortMethodRef, 1, 1);
}
break;
case ReferenceType.FIELD:
FieldReference fieldRef = (FieldReference) refInstr.getReference();
fieldReferenceCounts.adjustOrPutValue(fieldRef, 1, 1);
break;
case ReferenceType.STRING:
StringReference stringRef = (StringReference) refInstr.getReference();
stringReferenceCounts.adjustOrPutValue(stringRef, 1, 1);
break;
}
}
}
}
开发者ID:CalebFenton,项目名称:apkfile,代码行数:36,代码来源:DexMethod.java
示例9: getShortFieldDescriptor
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
public static String getShortFieldDescriptor(FieldReference fieldReference) {
StringBuilder sb = new StringBuilder();
sb.append(fieldReference.getName());
sb.append(':');
String clazz = TypeGenUtil.newType(fieldReference.getType());
sb.append(clazz);
return sb.toString();
}
开发者ID:alibaba,项目名称:atlas,代码行数:9,代码来源:ReferenceUtil.java
示例10: isStaticFiled
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
private static boolean isStaticFiled(DexBackedClassDef classDef, FieldReference reference) {
for (DexBackedField field : classDef.getStaticFields()) {
if (field.equals(reference)) {
return true;
}
}
return false;
}
开发者ID:alibaba,项目名称:atlas,代码行数:9,代码来源:ReferenceUtil.java
示例11: of
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Nonnull
public static ImmutableFieldReference of(@Nonnull FieldReference fieldReference) {
if (fieldReference instanceof ImmutableFieldReference) {
return (ImmutableFieldReference)fieldReference;
}
return new ImmutableFieldReference(
fieldReference.getDefiningClass(),
fieldReference.getName(),
fieldReference.getType());
}
开发者ID:CvvT,项目名称:andbg,代码行数:11,代码来源:ImmutableFieldReference.java
示例12: equals
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Override
public boolean equals(@Nullable Object o) {
if (o instanceof FieldReference) {
FieldReference other = (FieldReference)o;
return getDefiningClass().equals(other.getDefiningClass()) &&
getName().equals(other.getName()) &&
getType().equals(other.getType());
}
return false;
}
开发者ID:CvvT,项目名称:andbg,代码行数:12,代码来源:BaseFieldReference.java
示例13: compareTo
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Override
public int compareTo(@Nonnull FieldReference o) {
int res = getDefiningClass().compareTo(o.getDefiningClass());
if (res != 0) return res;
res = getName().compareTo(o.getName());
if (res != 0) return res;
return getType().compareTo(o.getType());
}
开发者ID:CvvT,项目名称:andbg,代码行数:9,代码来源:BaseFieldReference.java
示例14: makeInstructionWriter
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Nonnull static <StringRef extends StringReference, TypeRef extends TypeReference, FieldRefKey extends FieldReference, MethodRefKey extends MethodReference>
InstructionWriter<StringRef, TypeRef, FieldRefKey, MethodRefKey>
makeInstructionWriter(
@Nonnull DexDataWriter writer,
@Nonnull StringSection<?, StringRef> stringSection,
@Nonnull TypeSection<?, ?, TypeRef> typeSection,
@Nonnull FieldSection<?, ?, FieldRefKey, ?> fieldSection,
@Nonnull MethodSection<?, ?, ?, MethodRefKey, ?> methodSection) {
return new InstructionWriter<StringRef, TypeRef, FieldRefKey, MethodRefKey>(
writer, stringSection, typeSection, fieldSection, methodSection);
}
开发者ID:CvvT,项目名称:andbg,代码行数:12,代码来源:InstructionWriter.java
示例15: intern
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
public void intern(@Nonnull FieldReference field) {
Integer prev = internedItems.put(field, 0);
if (prev == null) {
typePool.intern(field.getDefiningClass());
stringPool.intern(field.getName());
typePool.intern(field.getType());
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:9,代码来源:FieldPool.java
示例16: internField
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Nonnull public BuilderFieldReference internField(@Nonnull FieldReference fieldReference) {
BuilderFieldReference ret = internedItems.get(fieldReference);
if (ret != null) {
return ret;
}
BuilderFieldReference dexPoolFieldReference = new BuilderFieldReference(
context.typePool.internType(fieldReference.getDefiningClass()),
context.stringPool.internString(fieldReference.getName()),
context.typePool.internType(fieldReference.getType()));
ret = internedItems.putIfAbsent(dexPoolFieldReference, dexPoolFieldReference);
return ret==null?dexPoolFieldReference:ret;
}
开发者ID:CvvT,项目名称:andbg,代码行数:14,代码来源:BuilderFieldPool.java
示例17: getReference
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Override @Nonnull public Reference getReference() {
switch (getReferenceType()) {
case ReferenceType.TYPE:
return RewriterUtils.rewriteTypeReference(rewriters.getTypeRewriter(),
(TypeReference)instruction.getReference());
case ReferenceType.FIELD:
return rewriters.getFieldReferenceRewriter().rewrite((FieldReference)instruction.getReference());
case ReferenceType.METHOD:
return rewriters.getMethodReferenceRewriter().rewrite((MethodReference)instruction.getReference());
case ReferenceType.STRING:
return instruction.getReference();
default:
throw new IllegalArgumentException();
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:16,代码来源:InstructionRewriter.java
示例18: getFieldByOffset
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Override
@Nullable
public FieldReference getFieldByOffset(int fieldOffset) {
if (getInstanceFields().size() == 0) {
return null;
}
return getInstanceFields().get(fieldOffset);
}
开发者ID:CvvT,项目名称:andbg,代码行数:9,代码来源:ClassProto.java
示例19: getFieldByOffset
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
@Override
@Nullable
public FieldReference getFieldByOffset(int fieldOffset) {
if (fieldOffset==8) {
return new ImmutableFieldReference(getType(), "length", "int");
}
return null;
}
开发者ID:CvvT,项目名称:andbg,代码行数:9,代码来源:ArrayProto.java
示例20: analyzeIgetSgetWideObject
import org.jf.dexlib2.iface.reference.FieldReference; //导入依赖的package包/类
private void analyzeIgetSgetWideObject(@Nonnull AnalyzedInstruction analyzedInstruction) {
ReferenceInstruction referenceInstruction = (ReferenceInstruction)analyzedInstruction.instruction;
FieldReference fieldReference = (FieldReference)referenceInstruction.getReference();
RegisterType fieldType = RegisterType.getRegisterType(classPath, fieldReference.getType());
setDestinationRegisterTypeAndPropagateChanges(analyzedInstruction, fieldType);
}
开发者ID:CvvT,项目名称:andbg,代码行数:9,代码来源:MethodAnalyzer.java
注:本文中的org.jf.dexlib2.iface.reference.FieldReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论