本文整理汇总了Java中org.jf.dexlib2.iface.MethodImplementation类的典型用法代码示例。如果您正苦于以下问题:Java MethodImplementation类的具体用法?Java MethodImplementation怎么用?Java MethodImplementation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MethodImplementation类属于org.jf.dexlib2.iface包,在下文中一共展示了MethodImplementation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internMethod
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Nonnull public BuilderMethod internMethod(@Nonnull String definingClass,
@Nonnull String name,
@Nullable List<? extends MethodParameter> parameters,
@Nonnull String returnType,
int accessFlags,
@Nonnull Set<? extends Annotation> annotations,
@Nullable MethodImplementation methodImplementation) {
if (parameters == null) {
parameters = ImmutableList.of();
}
return new BuilderMethod(context.methodPool.internMethod(definingClass, name, parameters, returnType),
internMethodParameters(parameters),
accessFlags,
context.annotationSetPool.internAnnotationSet(annotations),
methodImplementation);
}
示例2: internMethod
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
public BuilderMethod internMethod( String definingClass,
String name,
List<? extends MethodParameter> parameters,
String returnType,
int accessFlags,
Set<? extends Annotation> annotations,
MethodImplementation methodImplementation) {
if (parameters == null) {
parameters = ImmutableList.of();
}
return new BuilderMethod(methodSection.internMethod(definingClass, name, parameters, returnType),
internMethodParameters(parameters),
accessFlags,
annotationSetSection.internAnnotationSet(annotations),
methodImplementation);
}
示例3: BasicMethod
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
public BasicMethod(
String definingClass,
String name,
List<? extends MethodParameter> parameters,
String returnType,
int accessFlags,
Set<? extends Annotation> annotations,
MethodImplementation methodImplementation
) {
this.definingClass = definingClass;
this.name = name;
this.parameters = parameters;
this.returnType = returnType;
this.accessFlags = accessFlags;
this.annotations = annotations;
this.methodImplementation = methodImplementation;
}
示例4: internDebug
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
private void internDebug(@Nonnull Method method) {
for (MethodParameter param : method.getParameters()) {
String paramName = param.getName();
if (paramName != null) {
stringPool.intern(paramName);
}
}
MethodImplementation methodImpl = method.getImplementation();
if (methodImpl != null) {
for (DebugItem debugItem : methodImpl.getDebugItems()) {
switch (debugItem.getDebugItemType()) {
case DebugItemType.START_LOCAL:
StartLocal startLocal = (StartLocal) debugItem;
stringPool.internNullable(startLocal.getName());
typePool.internNullable(startLocal.getType());
stringPool.internNullable(startLocal.getSignature());
break;
case DebugItemType.SET_SOURCE_FILE:
stringPool.internNullable(((SetSourceFile) debugItem).getSourceFile());
break;
}
}
}
}
示例5: internMethod
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Nonnull
public BuilderMethod internMethod(@Nonnull String definingClass,
@Nonnull String name,
@Nullable List<? extends MethodParameter> parameters,
@Nonnull String returnType,
int accessFlags,
@Nonnull Set<? extends Annotation> annotations,
@Nullable MethodImplementation methodImplementation) {
if (parameters == null) {
parameters = ImmutableList.of();
}
return new BuilderMethod(context.methodPool.internMethod(definingClass, name, parameters, returnType),
internMethodParameters(parameters),
accessFlags,
context.annotationSetPool.internAnnotationSet(annotations),
methodImplementation);
}
示例6: translateClassDef
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
private ClassDetail translateClassDef(ClassInfo ci, ClassDef classDef, IdentityHashMap<MethodInfo, MethodImplementation> collector) {
ClassDetail.Builder builder = new ClassDetail.Builder();
if (classDef.getSuperclass() == null) {
builder.setBaseType(null); // for java.lang.Object
} else {
builder.setBaseType(Dalvik.findOrCreateClass(ci.scope, classDef.getSuperclass()));
}
builder.setInterfaces(findOrCreateClasses(ci.scope, classDef.getInterfaces()));
builder.setAccessFlags(translateAccessFlags(classDef.getAccessFlags()));
builder.setAllMethods(translateMethods(ci, classDef.getMethods(), collector));
builder.setStaticFields(translateFields(ci.scope, classDef.getStaticFields()));
HashMap<String, ClassInfo> fields = translateFields(ci.scope, classDef.getInstanceFields());
// TODO: do we need this?
if (ci.isInnerClass()) {
fields.put("this$0", ci.getOuterClass());
}
builder.setFields(fields);
builder.setIsFrameworkClass(isFramework);
return builder.build();
}
示例7: reMethodImpl
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Override
protected MethodImplementation reMethodImpl(MethodImplementation methodImplementation) {
if (methodImplementation == null){
return null;
}
Iterable<? extends Instruction> instructions = methodImplementation.getInstructions();
Iterable<? extends DebugItem> debugItems = methodImplementation.getDebugItems();
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = methodImplementation.getTryBlocks();
return new ImmutableMethodImplementation(methodImplementation.getRegisterCount(), reInstructions(instructions), reTryCatchBlock(methodImplementation.getTryBlocks()), reDebugItem(methodImplementation.getDebugItems()));
}
示例8: modifyMethodAndFix
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
private static MethodImplementation modifyMethodAndFix(@Nonnull MethodImplementation implementation, Method method) {
MutableMethodImplementation mutableImplementation = new MutableMethodImplementation(implementation);
System.out.println(mutableImplementation.getRegisterCount());
List<BuilderInstruction> instructions = mutableImplementation.getInstructions();
mutableImplementation.addInstruction(0,
new BuilderInstruction21c(Opcode.CONST_STRING, 0,
new ImmutableStringReference("AndFix:" + method.getDefiningClass().replace("/", "."))));
mutableImplementation.addInstruction(1,
new BuilderInstruction35c(Opcode.INVOKE_STATIC, 1,
0, 0, 0, 0, 0,
new ImmutableMethodReference("Landroid/util/Log;", "e",
Lists.newArrayList("Ljava/lang/String;", "Ljava/lang/String;"), "I")));
return mutableImplementation;
}
示例9: modifyMethodTpatch
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
private static MethodImplementation modifyMethodTpatch(@Nonnull MethodImplementation implementation, Method method) {
MutableMethodImplementation mutableImplementation = new MutableMethodImplementation(implementation);
System.out.println(mutableImplementation.getRegisterCount());
List<BuilderInstruction> instructions = mutableImplementation.getInstructions();
boolean isModified = false;
for (int i = 0; i < instructions.size(); i++) {
isModified = false;
if (instructions.get(i).getOpcode() == Opcode.INVOKE_DIRECT) {
if (!isModified) {
mutableImplementation.addInstruction(i++,
new BuilderInstruction21c(Opcode.CONST_STRING, 0,
new ImmutableStringReference("tpatch:" + method.getDefiningClass().replace("/", "."))));
mutableImplementation.addInstruction(i++,
new BuilderInstruction35c(Opcode.INVOKE_STATIC, 1,
0, 0, 0, 0, 0,
new ImmutableMethodReference("Landroid/util/Log;", "e",
Lists.newArrayList("Ljava/lang/String;", "Ljava/lang/String;"), "I")));
isModified = true;
break;
}
}
// mutableImplementation.addInstruction(instructions.get(i));
}
return mutableImplementation;
}
示例10: of
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Nullable
public static ImmutableMethodImplementation of(@Nullable MethodImplementation methodImplementation) {
if (methodImplementation == null) {
return null;
}
if (methodImplementation instanceof ImmutableMethodImplementation) {
return (ImmutableMethodImplementation)methodImplementation;
}
return new ImmutableMethodImplementation(
methodImplementation.getRegisterCount(),
methodImplementation.getInstructions(),
methodImplementation.getTryBlocks(),
methodImplementation.getDebugItems());
}
示例11: ImmutableMethod
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
public ImmutableMethod(@Nonnull String definingClass,
@Nonnull String name,
@Nullable Iterable<? extends MethodParameter> parameters,
@Nonnull String returnType,
int accessFlags,
@Nullable Set<? extends Annotation> annotations,
@Nullable MethodImplementation methodImplementation) {
this.definingClass = definingClass;
this.name = name;
this.parameters = ImmutableMethodParameter.immutableListOf(parameters);
this.returnType = returnType;
this.accessFlags = accessFlags;
this.annotations = ImmutableAnnotation.immutableSetOf(annotations);
this.methodImplementation = ImmutableMethodImplementation.of(methodImplementation);
}
示例12: getDebugItems
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Nullable @Override
public Iterable<? extends DebugItem> getDebugItems(@Nonnull BuilderMethod builderMethod) {
MethodImplementation impl = builderMethod.getImplementation();
if (impl == null) {
return null;
}
return impl.getDebugItems();
}
示例13: getRegisterCount
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Override public int getRegisterCount(@Nonnull BuilderMethod builderMethod) {
MethodImplementation impl = builderMethod.getImplementation();
if (impl == null) {
return 0;
}
return impl.getRegisterCount();
}
示例14: getInstructions
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Nullable @Override
public Iterable<? extends Instruction> getInstructions(@Nonnull BuilderMethod builderMethod) {
MethodImplementation impl = builderMethod.getImplementation();
if (impl == null) {
return null;
}
return impl.getInstructions();
}
示例15: getTryBlocks
import org.jf.dexlib2.iface.MethodImplementation; //导入依赖的package包/类
@Nonnull @Override
public List<? extends TryBlock<? extends ExceptionHandler>> getTryBlocks(@Nonnull BuilderMethod builderMethod) {
MethodImplementation impl = builderMethod.getImplementation();
if (impl == null) {
return ImmutableList.of();
}
return impl.getTryBlocks();
}