Java Code Examples for org.objectweb.asm.ModuleVisitor#visitProvide()
The following examples show how to use
org.objectweb.asm.ModuleVisitor#visitProvide() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ASMContentHandler.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
@Override public void end(final String element) { boolean exports = "exports".equals(element); boolean opens = "opens".equals(element); boolean provides = "provides".equals(element); if (exports | opens | provides) { @SuppressWarnings("unchecked") ArrayList<String> list = (ArrayList<String>) pop(); int access = (Integer) pop(); String name = (String) pop(); String[] tos = null; if (!list.isEmpty()) { tos = list.toArray(new String[list.size()]); } ModuleVisitor mv = (ModuleVisitor) peek(); if (exports) { mv.visitExport(name, access, tos); } else { if (opens) { mv.visitOpen(name, access, tos); } else { mv.visitProvide(name, tos); } } } else if ("module".equals(element)) { ((ModuleVisitor) pop()).visitEnd(); } }
Example 2
Source File: ClassWriterTest.java From turbine with Apache License 2.0 | 5 votes |
@Test public void module() throws Exception { org.objectweb.asm.ClassWriter cw = new org.objectweb.asm.ClassWriter(0); cw.visit(53, /* access= */ 53, "module-info", null, null, null); ModuleVisitor mv = cw.visitModule("mod", Opcodes.ACC_OPEN, "mod-ver"); mv.visitRequire("r1", Opcodes.ACC_TRANSITIVE, "r1-ver"); mv.visitRequire("r2", Opcodes.ACC_STATIC_PHASE, "r2-ver"); mv.visitRequire("r3", Opcodes.ACC_STATIC_PHASE | Opcodes.ACC_TRANSITIVE, "r3-ver"); mv.visitExport("e1", Opcodes.ACC_SYNTHETIC, "e1m1", "e1m2", "e1m3"); mv.visitExport("e2", Opcodes.ACC_MANDATED, "e2m1", "e2m2"); mv.visitExport("e3", /* access= */ 0, "e3m1"); mv.visitOpen("o1", Opcodes.ACC_SYNTHETIC, "o1m1", "o1m2", "o1m3"); mv.visitOpen("o2", Opcodes.ACC_MANDATED, "o2m1", "o2m2"); mv.visitOpen("o3", /* access= */ 0, "o3m1"); mv.visitUse("u1"); mv.visitUse("u2"); mv.visitUse("u3"); mv.visitUse("u4"); mv.visitProvide("p1", "p1i1", "p1i2"); mv.visitProvide("p2", "p2i1", "p2i2", "p2i3"); byte[] inputBytes = cw.toByteArray(); byte[] outputBytes = ClassWriter.writeClass(ClassReader.read("module-info", inputBytes)); assertThat(AsmUtils.textify(inputBytes, /* skipDebug= */ true)) .isEqualTo(AsmUtils.textify(outputBytes, /* skipDebug= */ true)); // test a round trip outputBytes = ClassWriter.writeClass(ClassReader.read("module-info", outputBytes)); assertThat(AsmUtils.textify(inputBytes, /* skipDebug= */ true)) .isEqualTo(AsmUtils.textify(outputBytes, /* skipDebug= */ true)); }
Example 3
Source File: ModuleProvideNode.java From Cafebabe with GNU General Public License v3.0 | 2 votes |
/** * Makes the given module visitor visit this require declaration. * * @param moduleVisitor * a module visitor. */ public void accept(final ModuleVisitor moduleVisitor) { moduleVisitor.visitProvide(service, providers.toArray(new String[0])); }
Example 4
Source File: ModuleProvideNode.java From Concurnas with MIT License | 2 votes |
/** * Makes the given module visitor visit this require declaration. * * @param moduleVisitor a module visitor. */ public void accept(final ModuleVisitor moduleVisitor) { moduleVisitor.visitProvide(service, providers.toArray(new String[0])); }
Example 5
Source File: ModuleProvideNode.java From JByteMod-Beta with GNU General Public License v2.0 | 2 votes |
/** * Makes the given module visitor visit this require declaration. * * @param mv * a module visitor. */ public void accept(final ModuleVisitor mv) { mv.visitProvide(service, providers.toArray(new String[0])); }
Example 6
Source File: ModuleProvideNode.java From JReFrameworker with MIT License | 2 votes |
/** * Makes the given module visitor visit this require declaration. * * @param moduleVisitor a module visitor. */ public void accept(final ModuleVisitor moduleVisitor) { moduleVisitor.visitProvide(service, providers.toArray(new String[0])); }
Example 7
Source File: ModuleProvideNode.java From JReFrameworker with MIT License | 2 votes |
/** * Makes the given module visitor visit this require declaration. * * @param moduleVisitor a module visitor. */ public void accept(final ModuleVisitor moduleVisitor) { moduleVisitor.visitProvide(service, providers.toArray(new String[0])); }