module.jpms
JPMS module tooling; read/write bytecode/sourcecode
Programmatic support for JPMS module-info
- Create and read module-info.class
- Create and read module-info.java
Used in archive.jpms
Examples
Bytecode easily available, furthermore invoking toString() returns the sourcecode:
ModuleInfo openModule = ModuleInfo.moduleInfo()
.named("com.acme.oh.pan")
.versioned("99")
.withAccess(of(OPEN))
.requiring("java.base", ACC_MANDATED, "9")
.construct();
String expected = "/**\n" +
" * @version 99\n" +
" * @modifiers open\n" +
" */\n" +
"open module com.acme.oh.pan {\n" +
" /**\n" +
" * @version 9\n" +
" * @modifiers mandated" +
" */\n" +
" requires java.base;\n" +
"}\n";
assertThat(openModule, hasToString(equalToIgnoringWhiteSpace(expected)));