private static int compareHandle(Handle h1, Handle h2) { int d = h1.getTag() - h2.getTag(); if (d == 0) { d = h1.getOwner().compareTo(h2.getOwner()); if (d == 0) { d = h1.getName().compareTo(h2.getName()); if (d == 0) { d = h1.getDesc().compareTo(h2.getDesc()); } } } return d; }
private String getLambdaAccessMethodDesc(Handle implMethod) { if (implMethod.getTag() == H_INVOKESTATIC) { // static method call -> keep as-is return implMethod.getDesc(); } else if (implMethod.getTag() == H_NEWINVOKESPECIAL) { // constructor call -> change to a a factory method return Types.changeReturnType( Type.getObjectType(implMethod.getOwner()), implMethod.getDesc()); } else { // instance method call -> change to a static method return Types.prependArgumentType(Type.getObjectType(className), implMethod.getDesc()); } }
void addConstant(final Object cst) { if (cst instanceof Type) { addType((Type) cst); } else if (cst instanceof Handle) { Handle h = (Handle) cst; addInternalName(h.getOwner()); addMethodDesc(h.getDesc()); } }
void addConstant(final Object constant) { if (constant instanceof Type) { addType((Type) constant); } else if (constant instanceof Handle) { Handle handle = (Handle) constant; addInternalType(handle.getOwner()); addMethodTypes(handle.getDesc()); } }
@Override public void visitLdcInsn(Object cst) { if (cst instanceof Handle) { Handle handle = (Handle) cst; cst = new Handle( handle.getTag(), handle.getOwner(), handle.getName(), getMethodDescriptor(handle.getDesc())); } super.visitLdcInsn(cst); }