@Override public String getKey(Method mtd) { return mtd.getName(); } });
public String getName() { return method.getName(); }
public void convertCode(DexMethodNode methodNode, MethodVisitor mv) { if ((readerConfig & DexFileReader.SKIP_CODE) != 0 && methodNode.method.getName().equals("<clinit>")) { // also skip clinit return; } super.convertCode(methodNode, mv); }
@Override public String toString0() { StringBuilder sb = new StringBuilder(); int i = 0; sb.append(ops[i++]).append('.').append(this.method.getName()); String[] argTypes = getProto().getParameterTypes(); sb.append('('); int j = 0; boolean first = true; for (; i < ops.length; i++) { if (first) { first = false; } else { sb.append(','); } sb.append("(").append(Util.toShortClassName(argTypes[j++])).append(")").append(ops[i]); } sb.append(')'); return sb.toString(); } }
@Override public String toString0() { StringBuilder sb = new StringBuilder(); int i = 0; if (super.vt == VT.INVOKE_NEW) { sb.append("new ").append(Util.toShortClassName(method.getOwner())); } else if (super.vt == VT.INVOKE_STATIC) { sb.append(Util.toShortClassName(method.getOwner())).append('.') .append(this.method.getName()); } else { sb.append(ops[i++]).append('.').append(this.method.getName()); } sb.append('('); boolean first = true; for (; i < ops.length; i++) { if (first) { first = false; } else { sb.append(','); } sb.append(ops[i]); } sb.append(')'); return sb.toString(); }
@Override public String toString() { return this.getOwner() + "." + this.getName() + this.getDesc(); } }
return cv.visitMethod(access, methodNode.method.getName(), methodNode.method.getDesc(), signature, xthrows);
static String escapeMethod(Method method) { return BaksmaliDumper.escapeType(method.getOwner()) + "->" + BaksmaliDumper.escapeId(method.getName()) + BaksmaliDumper.escapeMethodDesc(method); } static String escapeMethodDesc(Method m) {
public static String v(Method m) { return String.format("new Method(%s,%s,%s,%s)", v(m.getOwner()), v(m.getName()), v(m.getParameterTypes()), v(m.getReturnType())); } public static String v(Proto m) {
/** * @param isStatic * @param method */ public Dex2IrAdapter(boolean isStatic, Method method) { super(); IrMethod irMethod = new IrMethod(); irMethod.args = method.getParameterTypes(); irMethod.ret = method.getReturnType(); irMethod.owner = method.getOwner(); irMethod.name = method.getName(); irMethod.isStatic = isStatic; this.irMethod = irMethod; this.list = irMethod.stmts; this.irMethod = irMethod; this.method = method; this.isStatic = isStatic; }
case INVOKE_VIRTUAL_RANGE: case INVOKE_VIRTUAL: invoke = nInvokeVirtual(vs, method.getOwner(), method.getName(), method.getParameterTypes(), method.getReturnType()); break; case INVOKE_SUPER: case INVOKE_DIRECT: invoke = nInvokeSpecial(vs, method.getOwner(), method.getName(), method.getParameterTypes(), method.getReturnType()); break; case INVOKE_STATIC_RANGE: case INVOKE_STATIC: invoke = nInvokeStatic(vs, method.getOwner(), method.getName(), method.getParameterTypes(), method.getReturnType()); break; case INVOKE_INTERFACE_RANGE: case INVOKE_INTERFACE: invoke = nInvokeInterface(vs, method.getOwner(), method.getName(), method.getParameterTypes(), method.getReturnType()); break;
public MethodIdItem uniqMethod(Method method) { MethodIdItem key = new MethodIdItem(uniqType(method.getOwner()), uniqString(method.getName()), uniqProto(method)); return uniqMethod(key); }
Method method = m.method; appendAccess(m.access, buff); buff.append(escapeId(method.getName())).append(escapeMethodDesc(method)); out.s(buff.toString()); out.push();
DexAnnotationNode node = (DexAnnotationNode) findAnnotationAttribute(ann, "value"); if (node != null) { defaultValue = findAnnotationAttribute(node, methodNode.method.getName());
@Override public DexMethodVisitor visitMethod(final int accessFlags, Method method) { final DexMethodVisitor dmv = superVisitDexMethod(accessFlags, method); final MtdInfo mapTo = findDefinedTargetMethod(method.getOwner(), method.getName(), method.getDesc()); if (mapTo != null) { final Method t = new Method( method.getOwner(), buildMethodAName(method.getName()), method.getParameterTypes(), method .getReturnType() );
@Override public DexMethodVisitor visitMethod(int accessFlags, Method method) { String methodName = String.format("m%03d_%s", mCount++, method.getName().replace('<', '_').replace('>', '_')); out.s("%s(cv);", methodName);
@Override public void convertCode(DexMethodNode methodNode, MethodVisitor mv) { MethodVisitor mw = AsmBridge.searchMethodWriter(mv); MethodNode mn = new MethodNode(Opcodes.ASM5, methodNode.access, methodNode.method.getName(), methodNode.method.getDesc(), null, null); try { super.convertCode(methodNode, mn); } catch (Exception ex) { if (exceptionHandler == null) { throw new DexException(ex, "fail convert code for %s", methodNode.method); } else { mn.instructions.clear(); mn.tryCatchBlocks.clear(); exceptionHandler.handleMethodTranslateException(methodNode.method, methodNode, mn, ex); } } // code convert ok, copy to MethodWriter and check for Size mn.accept(mv); if (mw != null) { try { AsmBridge.sizeOfMethodWriter(mw); } catch (Exception ex) { mn.instructions.clear(); mn.tryCatchBlocks.clear(); exceptionHandler.handleMethodTranslateException(methodNode.method, methodNode, mn, ex); AsmBridge.replaceMethodWriter(mw, mn); } } } }
Method m; if (isSuper || isStatic) { m = new Method(t.getOwner(), buildCallbackMethodName(t.getName()), new String[]{ "[Ljava/lang/Object;" }, "Ljava/lang/Object;"); } else { m = new Method(t.getOwner(), buildCallbackMethodName(t.getName()), new String[]{ "Ljava/lang/Object;", "[Ljava/lang/Object;" }, "Ljava/lang/Object;");
break; case MethodHandle.INVOKE_INSTANCE: h = new Handle(Opcodes.H_INVOKEVIRTUAL, toInternalName(mh.getMethod().getOwner()), mh.getMethod().getName(), mh.getMethod().getDesc()); break; case MethodHandle.INVOKE_STATIC: h = new Handle(Opcodes.H_INVOKESTATIC, toInternalName(mh.getMethod().getOwner()), mh.getMethod().getName(), mh.getMethod().getDesc()); break; case MethodHandle.INVOKE_CONSTRUCTOR: h = new Handle(Opcodes.H_NEWINVOKESPECIAL, toInternalName(mh.getMethod().getOwner()), mh.getMethod().getName(), mh.getMethod().getDesc()); break; case MethodHandle.INVOKE_DIRECT: h = new Handle(Opcodes.H_INVOKESPECIAL, toInternalName(mh.getMethod().getOwner()), mh.getMethod().getName(), mh.getMethod().getDesc()); break; case MethodHandle.INVOKE_INTERFACE: h = new Handle(Opcodes.H_INVOKEINTERFACE, toInternalName(mh.getMethod().getOwner()), mh.getMethod().getName(), mh.getMethod().getDesc()); break;