private boolean equalTo(ImmutablePointcutMethod another) { return name.equals(another.name) && descriptor.equals(another.descriptor) && annotationTypes.equals(another.annotationTypes) && parameterAnnotationTypes.equals(another.parameterAnnotationTypes) && toAsmMethod.equals(another.toAsmMethod); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof ConstructorRef) { ConstructorRef that = (ConstructorRef) o; return (this.instanceClass.equals(that.instanceClass())) && (this.method.equals(that.method())) && (this.argTypes.equals(that.argTypes())); } return false; }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); // If the resource method is declared, no need to generate at the end. Method method = new Method(name, desc); resourceMethods.remove(method); hasParentLoader = hasParentLoader || parentLoaderMethod.equals(method); if (!rewriteInit || !"<init>".equals(name)) { return mv; } return new GeneratorAdapter(Opcodes.ASM5, mv, access, name, desc) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { // If there is a call to `super()`, skip that instruction and have the onMethodEnter generate the call if (opcode == Opcodes.INVOKESPECIAL && Type.getObjectType(owner).equals(classloaderType) && name.equals("<init>") && Type.getArgumentTypes(desc).length == 0 && Type.getReturnType(desc).equals(Type.VOID_TYPE)) { // Generate `super(null)`. The `this` is already in the stack, so no need to `loadThis()` push((Type) null); invokeConstructor(classloaderType, new Method("<init>", Type.VOID_TYPE, new Type[] { classloaderType })); } else { super.visitMethodInsn(opcode, owner, name, desc, itf); } } }; }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); // If the resource method is declared, no need to generate at the end. Method method = new Method(name, desc); resourceMethods.remove(method); hasParentLoader = hasParentLoader || parentLoaderMethod.equals(method); if (!rewriteInit || !"<init>".equals(name)) { return mv; } return new GeneratorAdapter(Opcodes.ASM5, mv, access, name, desc) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { // If there is a call to `super()`, skip that instruction and have the onMethodEnter generate the call if (opcode == Opcodes.INVOKESPECIAL && Type.getObjectType(owner).equals(classloaderType) && name.equals("<init>") && Type.getArgumentTypes(desc).length == 0 && Type.getReturnType(desc).equals(Type.VOID_TYPE)) { // Generate `super(null)`. The `this` is already in the stack, so no need to `loadThis()` push((Type) null); invokeConstructor(classloaderType, new Method("<init>", Type.VOID_TYPE, new Type[] { classloaderType })); } else { super.visitMethodInsn(opcode, owner, name, desc, itf); } } }; }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); // If the resource method is declared, no need to generate at the end. Method method = new Method(name, desc); resourceMethods.remove(method); hasParentLoader = hasParentLoader || parentLoaderMethod.equals(method); if (!rewriteInit || !"<init>".equals(name)) { return mv; } return new GeneratorAdapter(Opcodes.ASM5, mv, access, name, desc) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { // If there is a call to `super()`, skip that instruction and have the onMethodEnter generate the call if (opcode == Opcodes.INVOKESPECIAL && Type.getObjectType(owner).equals(classloaderType) && name.equals("<init>") && Type.getArgumentTypes(desc).length == 0 && Type.getReturnType(desc).equals(Type.VOID_TYPE)) { // Generate `super(null)`. The `this` is already in the stack, so no need to `loadThis()` push((Type) null); invokeConstructor(classloaderType, new Method("<init>", Type.VOID_TYPE, new Type[] { classloaderType })); } else { super.visitMethodInsn(opcode, owner, name, desc, itf); } } }; }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof MethodRef) { MethodRef that = (MethodRef) o; return (this.opcode == that.opcode()) && (this.owner.equals(that.owner())) && (this.method.equals(that.method())) && (this.returnType.equals(that.returnType())) && (this.argTypes.equals(that.argTypes())) && (this.features.equals(that.features())); } return false; }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); if (!mainMethod.equals(new Method(name, desc)) || !Modifier.isStatic(access)) { return mv;
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); if (!mainMethod.equals(new Method(name, desc)) || !Modifier.isStatic(access)) { return mv;
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); if (!mainMethod.equals(new Method(name, desc)) || !Modifier.isStatic(access)) { return mv;