Example usage for org.objectweb.asm Opcodes ACC_MODULE

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

Introduction

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

Prototype

int ACC_MODULE

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

Click Source Link

Usage

From source file:ModuleInfoGenerator.java

License:Open Source License

public static void main(String[] args) throws Exception {
    File dest = new File(args[0]);
    ClassWriter cw = new ClassWriter(0);
    cw.visit(V9, Opcodes.ACC_MODULE, "module-info", null, null, null);
    ModuleVisitor mv = cw.visitModule("org.joml", 0, args[1]);
    mv.visitRequire("java.base", ACC_MANDATED, "9");
    mv.visitRequire("jdk.unsupported", ACC_STATIC_PHASE, null);
    mv.visitExport("org/joml", 0, (String[]) null);
    mv.visitExport("org/joml/sampling", 0, (String[]) null);
    mv.visitEnd();/*from  w  ww .  j  a va 2 s  .  com*/
    cw.visitEnd();
    FileOutputStream fos = new FileOutputStream(new File(dest, "module-info.class"));
    fos.write(cw.toByteArray());
    fos.close();
}

From source file:com.github.jasmo.obfuscate.FullAccessFlags.java

License:Open Source License

private int access(int access) {
    int a = Opcodes.ACC_PUBLIC;
    if ((access & Opcodes.ACC_NATIVE) != 0)
        a |= Opcodes.ACC_NATIVE;/*from  www.j a va 2 s  . c o m*/
    if ((access & Opcodes.ACC_ABSTRACT) != 0)
        a |= Opcodes.ACC_ABSTRACT;
    if ((access & Opcodes.ACC_ANNOTATION) != 0)
        a |= Opcodes.ACC_ANNOTATION;
    if ((access & Opcodes.ACC_BRIDGE) != 0)
        a |= Opcodes.ACC_BRIDGE;
    //if ((access & Opcodes.ACC_DEPRECATED) != 0) a |= Opcodes.ACC_DEPRECATED;
    if ((access & Opcodes.ACC_ENUM) != 0)
        a |= Opcodes.ACC_ENUM;
    if ((access & Opcodes.ACC_FINAL) != 0)
        a |= Opcodes.ACC_FINAL;
    if ((access & Opcodes.ACC_INTERFACE) != 0)
        a |= Opcodes.ACC_INTERFACE;
    if ((access & Opcodes.ACC_MANDATED) != 0)
        a |= Opcodes.ACC_MANDATED;
    if ((access & Opcodes.ACC_MODULE) != 0)
        a |= Opcodes.ACC_MODULE;
    if ((access & Opcodes.ACC_OPEN) != 0)
        a |= Opcodes.ACC_OPEN;
    if ((access & Opcodes.ACC_STATIC) != 0)
        a |= Opcodes.ACC_STATIC;
    if ((access & Opcodes.ACC_STATIC_PHASE) != 0)
        a |= Opcodes.ACC_STATIC_PHASE;
    if ((access & Opcodes.ACC_STRICT) != 0)
        a |= Opcodes.ACC_STRICT;
    if ((access & Opcodes.ACC_SUPER) != 0)
        a |= Opcodes.ACC_SUPER;
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0)
        a |= Opcodes.ACC_SYNCHRONIZED;
    if ((access & Opcodes.ACC_SYNTHETIC) != 0)
        a |= Opcodes.ACC_SYNTHETIC;
    if ((access & Opcodes.ACC_TRANSIENT) != 0)
        a |= Opcodes.ACC_TRANSIENT;
    if ((access & Opcodes.ACC_TRANSITIVE) != 0)
        a |= Opcodes.ACC_TRANSITIVE;
    if ((access & Opcodes.ACC_VARARGS) != 0)
        a |= Opcodes.ACC_VARARGS;
    if ((access & Opcodes.ACC_VOLATILE) != 0)
        a |= Opcodes.ACC_VOLATILE;
    return a;
}

From source file:org.jacoco.core.analysis.AnalyzerTest.java

License:Open Source License

@Test
public void should_ignore_module_info() throws Exception {
    final ClassWriter cw = new ClassWriter(0);
    cw.visit(Opcodes.V9, Opcodes.ACC_MODULE, "module-info", null, null, null);
    cw.visitModule("module", 0, null).visitEnd();
    cw.visitEnd();//from   w ww.j ava2  s. c  o m
    final byte[] bytes = cw.toByteArray();

    analyzer.analyzeClass(bytes, "");

    assertTrue(classes.isEmpty());
}

From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactory.java

License:Open Source License

private static boolean isInterfaceOrModule(final ClassReader reader) {
    return (reader.getAccess() & (Opcodes.ACC_INTERFACE | Opcodes.ACC_MODULE)) != 0;
}

From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java

License:Open Source License

private IProbeArrayStrategy createForModule(int version) {
    final ClassWriter writer = new ClassWriter(0);
    writer.visit(version, Opcodes.ACC_MODULE, "module-info", null, null, null);
    writer.visitModule("module", 0, null).visitEnd();
    writer.visitEnd();/*from  w  ww  . j  a v  a 2 s .  com*/
    return ProbeArrayStrategyFactory.createFor(0, new ClassReader(writer.toByteArray()), generator);
}