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:com.github.veithen.phos.enforcer.MethodProcessor.java

License:Apache License

MethodProcessor(ReferenceProcessor referenceProcessor) {
    super(Opcodes.ASM5);
    this.referenceProcessor = referenceProcessor;
}

From source file:com.github.wolf480pl.mias4j.core.rewrite.SandboxAdapter.java

License:Open Source License

public SandboxAdapter(ClassVisitor cv, RewritePolicy policy) {
    super(Opcodes.ASM5, cv);
    this.policy = policy;
}

From source file:com.github.wolf480pl.mias4j.util.SequenceMethodVisitor.java

License:Open Source License

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

From source file:com.github.wolf480pl.mias4j.util.SequenceMethodVisitor.java

License:Open Source License

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

From source file:com.google.classyshark.silverghost.contentreader.clazz.ClassNameVisitor.java

License:Apache License

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

From source file:com.google.classyshark.silverghost.translator.java.clazz.asm.ClassDetailsFiller.java

License:Apache License

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

From source file:com.google.devtools.build.android.desugar.Bug62456849TestDataGenerator.java

License:Open Source License

private static byte[] convertClass(ZipFile file, ZipEntry entry) throws IOException {
    try (InputStream content = file.getInputStream(entry)) {
        ClassReader reader = new ClassReader(content);
        ClassWriter writer = new ClassWriter(0);
        ClassVisitor converter = new ClassVisitor(Opcodes.ASM5, writer) {
            @Override//from  www. j a  v a2 s .c o  m
            public MethodVisitor visitMethod(int access, String name, String desc, String signature,
                    String[] exceptions) {
                if (name.startsWith("lambda$") && (access & Opcodes.ACC_SYNTHETIC) == 0) {
                    access |= Opcodes.ACC_SYNTHETIC;
                }
                return super.visitMethod(access, name, desc, signature, exceptions);
            }
        };
        reader.accept(converter, 0);
        return writer.toByteArray();
    }
}

From source file:com.google.devtools.build.android.desugar.DefaultMethodClassFixer.java

License:Open Source License

public DefaultMethodClassFixer(ClassVisitor dest, ClassReaderFactory classpath,
        ClassReaderFactory bootclasspath, ClassLoader targetLoader) {
    super(Opcodes.ASM5, dest);
    this.classpath = classpath;
    this.bootclasspath = bootclasspath;
    this.targetLoader = targetLoader;
}

From source file:com.google.devtools.build.android.desugar.DefaultMethodClassFixerTest.java

License:Open Source License

private void checkClinitForDefaultInterfaceMethodWithStaticInitializerTestInterfaceSetOneC(
        byte[] classContent) {
    ClassReader reader = new ClassReader(classContent);
    reader.accept(new ClassVisitor(Opcodes.ASM5) {

        class ClinitMethod extends MethodNode {

            public ClinitMethod(int access, String name, String desc, String signature, String[] exceptions) {
                super(Opcodes.ASM5, access, name, desc, signature, exceptions);
            }/*from   w  ww.j  a v  a  2 s.c  om*/
        }

        private ClinitMethod clinit;

        @Override
        public MethodVisitor visitMethod(int access, String name, String desc, String signature,
                String[] exceptions) {
            if ("<clinit>".equals(name)) {
                assertThat(clinit).isNull();
                clinit = new ClinitMethod(access, name, desc, signature, exceptions);
                return clinit;
            }
            return super.visitMethod(access, name, desc, signature, exceptions);
        }

        @Override
        public void visitEnd() {
            assertThat(clinit).isNotNull();
            assertThat(clinit.instructions.size()).isEqualTo(3);
            AbstractInsnNode instruction = clinit.instructions.getFirst();
            {
                assertThat(instruction).isInstanceOf(MethodInsnNode.class);
                MethodInsnNode field = (MethodInsnNode) instruction;
                assertThat(field.owner).isEqualTo("com/google/devtools/build/android/desugar/testdata/java8/"
                        + "DefaultInterfaceMethodWithStaticInitializer" + "$TestInterfaceSetOne$I1$$CC");
                assertThat(field.name)
                        .isEqualTo(InterfaceDesugaring.COMPANION_METHOD_TO_TRIGGER_INTERFACE_CLINIT_NAME);
                assertThat(field.desc)
                        .isEqualTo(InterfaceDesugaring.COMPANION_METHOD_TO_TRIGGER_INTERFACE_CLINIT_DESC);
            }
            {
                instruction = instruction.getNext();
                assertThat(instruction).isInstanceOf(MethodInsnNode.class);
                MethodInsnNode field = (MethodInsnNode) instruction;
                assertThat(field.owner).isEqualTo("com/google/devtools/build/android/desugar/testdata/java8/"
                        + "DefaultInterfaceMethodWithStaticInitializer" + "$TestInterfaceSetOne$I2$$CC");
                assertThat(field.name)
                        .isEqualTo(InterfaceDesugaring.COMPANION_METHOD_TO_TRIGGER_INTERFACE_CLINIT_NAME);
                assertThat(field.desc)
                        .isEqualTo(InterfaceDesugaring.COMPANION_METHOD_TO_TRIGGER_INTERFACE_CLINIT_DESC);
            }
            {
                instruction = instruction.getNext();
                assertThat(instruction).isInstanceOf(InsnNode.class);
                assertThat(instruction.getOpcode()).isEqualTo(Opcodes.RETURN);
            }
        }
    }, 0);
}

From source file:com.google.devtools.build.android.desugar.DesugarLongCompareTest.java

License:Open Source License

@Test
public void testClassCallingLongCompareHasNoReferenceToLong_compare() {
    try {//from   ww  w .  j ava  2  s .  c o m
        ClassReader reader = new ClassReader(ClassCallingLongCompare.class.getName());

        AtomicInteger counter = new AtomicInteger(0);

        reader.accept(new ClassVisitor(Opcodes.ASM5) {
            @Override
            public MethodVisitor visitMethod(int access, String name, String desc, String signature,
                    String[] exceptions) {
                return new MethodVisitor(api) {
                    @Override
                    public void visitMethodInsn(int opcode, String owner, String name, String desc,
                            boolean itf) {
                        if (opcode == INVOKESTATIC && owner.equals("java/lang/Long") && name.equals("compare")
                                && desc.equals("(JJ)I")) {
                            counter.incrementAndGet();
                        }
                    }
                };
            }
        }, 0);
        assertThat(counter.get()).isEqualTo(0);
    } catch (IOException e) {
        fail();
    }
}