Example usage for org.objectweb.asm Opcodes ASM5

List of usage examples for org.objectweb.asm Opcodes ASM5

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ASM5.

Prototype

int ASM5

To view the source code for org.objectweb.asm Opcodes ASM5.

Click Source Link

Usage

From source file:net.orfjackal.retrolambda.interfaces.WarnAboutDefaultAndStaticMethods.java

License:Open Source License

public WarnAboutDefaultAndStaticMethods(ClassVisitor next) {
    super(Opcodes.ASM5, next);
}

From source file:net.orfjackal.retrolambda.lambdas.RemoveLambdaFormHiddenAnnotation.java

License:Open Source License

public RemoveLambdaFormHiddenAnnotation(MethodVisitor mv) {
    super(Opcodes.ASM5, mv);
}

From source file:net.orfjackal.retrolambda.requirenonnull.RequireNonNull.java

License:Open Source License

public RequireNonNull(ClassVisitor next) {
    super(Opcodes.ASM5, next);
}

From source file:net.orfjackal.retrolambda.requirenonnull.RequireNonNull.java

License:Open Source License

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    MethodVisitor next = super.visitMethod(access, name, desc, signature, exceptions);
    return new MethodVisitor(Opcodes.ASM5, next) {
        @Override/*from   w  ww  .java  2  s . com*/
        public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
            if (opcode == Opcodes.INVOKESTATIC && owner.equals("java/util/Objects")
                    && name.equals("requireNonNull") && desc.equals("(Ljava/lang/Object;)Ljava/lang/Object;")) {
                super.visitInsn(Opcodes.DUP);
                super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "getClass",
                        "()Ljava/lang/Class;", false);
                super.visitInsn(Opcodes.POP);
            } else {
                super.visitMethodInsn(opcode, owner, name, desc, itf);
            }
        }
    };
}

From source file:net.sf.cglib.core.ClassEmitter.java

License:Apache License

public ClassEmitter() {
    super(Opcodes.ASM5);
}

From source file:net.sf.cglib.core.ClassEmitter.java

License:Apache License

public CodeEmitter begin_method(int access, Signature sig, String signature, Type[] exceptions) {
    if (classInfo == null)
        throw new IllegalStateException("classInfo is null! " + this);
    MethodVisitor v = cv.visitMethod(access, sig.getName(), sig.getDescriptor(), signature,
            TypeUtils.toInternalNames(exceptions));
    if (sig.equals(Constants.SIG_STATIC) && !TypeUtils.isInterface(getAccess())) {
        rawStaticInit = v;//  w  ww  .  j a  va 2 s  .co m
        MethodVisitor wrapped = new MethodVisitor(Opcodes.ASM5, v) {
            public void visitMaxs(int maxStack, int maxLocals) {
                // ignore
            }

            public void visitInsn(int insn) {
                if (insn != Constants.RETURN) {
                    super.visitInsn(insn);
                }
            }
        };
        staticInit = new CodeEmitter(this, wrapped, access, sig, exceptions);
        if (staticHook == null) {
            // force static hook creation
            getStaticHook();
        } else {
            staticInit.invoke_static_this(staticHookSig);
        }
        return staticInit;
    } else if (sig.equals(staticHookSig)) {
        return new CodeEmitter(this, v, access, sig, exceptions) {
            public boolean isStaticHook() {
                return true;
            }
        };
    } else {
        return new CodeEmitter(this, v, access, sig, exceptions);
    }
}

From source file:net.sf.cglib.core.ClassNameReader.java

License:Apache License

public static String[] getClassInfo(ClassReader r) {
    final List array = new ArrayList();
    try {//from   w w w. j ava  2s . c  o m
        r.accept(new ClassVisitor(Opcodes.ASM5, null) {
            public void visit(int version, int access, String name, String signature, String superName,
                    String[] interfaces) {
                array.add(name.replace('/', '.'));
                if (superName != null) {
                    array.add(superName.replace('/', '.'));
                }
                for (int i = 0; i < interfaces.length; i++) {
                    array.add(interfaces[i].replace('/', '.'));
                }

                throw EARLY_EXIT;
            }
        }, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
    } catch (EarlyExitException e) {
    }

    return (String[]) array.toArray(new String[] {});
}

From source file:net.sf.cglib.core.DebuggingClassWriter.java

License:Apache License

public DebuggingClassWriter(int flags) {
    super(Opcodes.ASM5, new ClassWriter(flags));
}

From source file:net.sf.cglib.transform.AbstractClassTransformer.java

License:Apache License

protected AbstractClassTransformer() {
    super(Opcodes.ASM5);
}

From source file:net.sf.cglib.transform.AnnotationVisitorTee.java

License:Apache License

public AnnotationVisitorTee(AnnotationVisitor av1, AnnotationVisitor av2) {
    super(Opcodes.ASM5);
    this.av1 = av1;
    this.av2 = av2;
}