ASM 6 update 2 (jigsaw / java 9)

Remi Forax <[email protected]> Sun, 28 Aug 2016 00:08:20 +0200 (CEST)
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi everybody,
I'm pleased to announce that i've updated the ASM 6 branch
  http://websvn.ow2.org/listing.php?repname=asm&path=%2Fbranches%2FASM_6_FUTURE%2F
to follow the latest classfile format spec [1].
The corresponding change in the JDK9 (javac/javap/VM) should integrated next week [2] so if you want to test in between you have to use the jigsaw/jake special build [3].

Here is an example of the current API,
the main change is that you are now able to specify the version of a module or the main class directly without creating your own attribute.

    ClassWriter writer = new ClassWriter(0);
    writer.visit(Opcodes.V1_9, Opcodes.ACC_MODULE, "genmodule/module-info", null, null, null);
    
    ModuleVisitor module = writer.visitModule();
    module.visitVersion("1.0.0");
    module.visitMainClass("org/objectweb/asm/FunMain");
    module.visitTargetPlatform("MyOS", null, "3.4");
    module.visitConcealedPackage("org/objectweb/asm/concealed");
    module.visitConcealedPackage("org/objectweb/asm/concealed2");
    
    module.visitRequire("asm.fun", Opcodes.ACC_TRANSITIVE);
    module.visitRequire("asm.static", Opcodes.ACC_STATIC_PHASE);
    module.visitRequire("asm.foo", 0);
    
    module.visitExport("org/objectweb/asm", 0);
    module.visitExport("org/objectweb/asm/util", Opcodes.ACC_DYNAMIC_PHASE, "java.base", "java.sql");
    
    module.visitUse("org/objectweb/asm/FunInterface");
    module.visitProvide("org/objectweb/asm/FunInterface", "org/objectweb/asm/FunImpl");
    
    module.visitEnd();
    
    writer.visitEnd();  

regards,
Rémi

[1] http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
[2] https://jdk9.java.net/
[3] https://jdk9.java.net/jigsaw/


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws