MethodId(TypeId<D> declaringType, TypeId<R> returnType, String name, TypeList parameters) { if (declaringType == null || returnType == null || name == null || parameters == null) { throw new NullPointerException(); } this.declaringType = declaringType; this.returnType = returnType; this.name = name; this.parameters = parameters; this.nat = new CstNat(new CstString(name), new CstString(descriptor(false))); this.constant = new CstMethodRef(declaringType.constant, nat); }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
/** * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to * this instance. * * @return {@code non-null;} an appropriate instance */ public CstMethodRef toMethodRef() { if (methodRef == null) { methodRef = new CstMethodRef(getDefiningClass(), getNat()); } return methodRef; } }
private static CstMethodRef makeInvokeMethod(final CstMethodRef callSiteMethod) { // The name is either invoke or invokeExact. The INVOKE_DESCRIPTOR is fixed. CstNat cstNat = new CstNat(callSiteMethod.getNat().getName(), INVOKE_DESCRIPTOR); return new CstMethodRef(CstType.METHOD_HANDLE, cstNat); }
MethodId(Type<D> declaringType, Type<R> returnType, String name, TypeList parameters) { if (declaringType == null || returnType == null || name == null || parameters == null) { throw new NullPointerException(); } this.declaringType = declaringType; this.returnType = returnType; this.name = name; this.parameters = parameters; this.nat = new CstNat(new CstString(name), new CstString(descriptor(false))); this.constant = new CstMethodRef(declaringType.constant, nat); }
MethodId(TypeId<D> declaringType, TypeId<R> returnType, String name, TypeList parameters) { if (declaringType == null || returnType == null || name == null || parameters == null) { throw new NullPointerException(); } this.declaringType = declaringType; this.returnType = returnType; this.name = name; this.parameters = parameters; this.nat = new CstNat(new CstString(name), new CstString(descriptor(false))); this.constant = new CstMethodRef(declaringType.constant, nat); }
MethodId(TypeId<D> declaringType, TypeId<R> returnType, String name, TypeList parameters) { if (declaringType == null || returnType == null || name == null || parameters == null) { throw new NullPointerException(); } this.declaringType = declaringType; this.returnType = returnType; this.name = name; this.parameters = parameters; this.nat = new CstNat(new CstString(name), new CstString(descriptor(false))); this.constant = new CstMethodRef(declaringType.constant, nat); }
new CstMethodRef(enclosingClass, nat));
new CstMethodRef(enclosingClass, nat));
new CstMethodRef(enclosingClass, nat));
new CstMethodRef(enclosingClass, nat));
new CstMethodRef(enclosingClass, nat));
new CstMethodRef(enclosingClass, nat));
/** * Extracts the code block from the given method of the given class, or * <code>null</code>, if method is native or abstract. */ private static DalvCode getCode(Method method, DirectClassFile classFile) { boolean isNative= AccessFlags.isNative(method.getAccessFlags()); boolean isStatic= AccessFlags.isStatic(method.getAccessFlags()); boolean isAbstract= AccessFlags.isAbstract(method.getAccessFlags()); if (isNative || isAbstract) { return null; } ConcreteMethod concrete= new ConcreteMethod(method, classFile, false, false); TranslationAdvice advice= DexTranslationAdvice.THE_ONE; RopMethod rmeth= Ropper.convert(concrete, advice); CstMethodRef meth= new CstMethodRef(method.getDefiningClass(), method.getNat()); int paramSize= meth.getParameterWordCount(isStatic); DalvCode code= RopTranslator.translate(rmeth, PositionList.NONE, null, paramSize); DalvCode.AssignIndicesCallback callback= new DalvCode.AssignIndicesCallback() { public int getIndex(Constant cst) { // Everything is at index 0! return 0; } }; code.assignIndices(callback); return code; }