Java Code Examples for org.objectweb.asm.ModuleVisitor#visitUse()
The following examples show how to use
org.objectweb.asm.ModuleVisitor#visitUse() .
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: ModuleNode.java From Cafebabe with GNU General Public License v3.0 | 5 votes |
/** * Makes the given class visitor visit this module. * * @param classVisitor * a class visitor. */ public void accept(final ClassVisitor classVisitor) { ModuleVisitor moduleVisitor = classVisitor.visitModule(name, access, version); if (moduleVisitor == null) { return; } if (mainClass != null) { moduleVisitor.visitMainClass(mainClass); } if (packages != null) { for (int i = 0, n = packages.size(); i < n; i++) { moduleVisitor.visitPackage(packages.get(i)); } } if (requires != null) { for (int i = 0, n = requires.size(); i < n; i++) { requires.get(i).accept(moduleVisitor); } } if (exports != null) { for (int i = 0, n = exports.size(); i < n; i++) { exports.get(i).accept(moduleVisitor); } } if (opens != null) { for (int i = 0, n = opens.size(); i < n; i++) { opens.get(i).accept(moduleVisitor); } } if (uses != null) { for (int i = 0, n = uses.size(); i < n; i++) { moduleVisitor.visitUse(uses.get(i)); } } if (provides != null) { for (int i = 0, n = provides.size(); i < n; i++) { provides.get(i).accept(moduleVisitor); } } }
Example 2
Source File: ModuleNode.java From Concurnas with MIT License | 5 votes |
/** * Makes the given class visitor visit this module. * * @param classVisitor a class visitor. */ public void accept(final ClassVisitor classVisitor) { ModuleVisitor moduleVisitor = classVisitor.visitModule(name, access, version); if (moduleVisitor == null) { return; } if (mainClass != null) { moduleVisitor.visitMainClass(mainClass); } if (packages != null) { for (int i = 0, n = packages.size(); i < n; i++) { moduleVisitor.visitPackage(packages.get(i)); } } if (requires != null) { for (int i = 0, n = requires.size(); i < n; i++) { requires.get(i).accept(moduleVisitor); } } if (exports != null) { for (int i = 0, n = exports.size(); i < n; i++) { exports.get(i).accept(moduleVisitor); } } if (opens != null) { for (int i = 0, n = opens.size(); i < n; i++) { opens.get(i).accept(moduleVisitor); } } if (uses != null) { for (int i = 0, n = uses.size(); i < n; i++) { moduleVisitor.visitUse(uses.get(i)); } } if (provides != null) { for (int i = 0, n = provides.size(); i < n; i++) { provides.get(i).accept(moduleVisitor); } } }
Example 3
Source File: ModuleNode.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
public void accept(final ClassVisitor cv) { ModuleVisitor mv = cv.visitModule(name, access, version); if (mv == null) { return; } if (mainClass != null) { mv.visitMainClass(mainClass); } if (packages != null) { for (int i = 0; i < packages.size(); i++) { mv.visitPackage(packages.get(i)); } } if (requires != null) { for (int i = 0; i < requires.size(); i++) { requires.get(i).accept(mv); } } if (exports != null) { for (int i = 0; i < exports.size(); i++) { exports.get(i).accept(mv); } } if (opens != null) { for (int i = 0; i < opens.size(); i++) { opens.get(i).accept(mv); } } if (uses != null) { for (int i = 0; i < uses.size(); i++) { mv.visitUse(uses.get(i)); } } if (provides != null) { for (int i = 0; i < provides.size(); i++) { provides.get(i).accept(mv); } } }
Example 4
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 5
Source File: ModuleNode.java From JReFrameworker with MIT License | 5 votes |
/** * Makes the given class visitor visit this module. * * @param classVisitor a class visitor. */ public void accept(final ClassVisitor classVisitor) { ModuleVisitor moduleVisitor = classVisitor.visitModule(name, access, version); if (moduleVisitor == null) { return; } if (mainClass != null) { moduleVisitor.visitMainClass(mainClass); } if (packages != null) { for (int i = 0, n = packages.size(); i < n; i++) { moduleVisitor.visitPackage(packages.get(i)); } } if (requires != null) { for (int i = 0, n = requires.size(); i < n; i++) { requires.get(i).accept(moduleVisitor); } } if (exports != null) { for (int i = 0, n = exports.size(); i < n; i++) { exports.get(i).accept(moduleVisitor); } } if (opens != null) { for (int i = 0, n = opens.size(); i < n; i++) { opens.get(i).accept(moduleVisitor); } } if (uses != null) { for (int i = 0, n = uses.size(); i < n; i++) { moduleVisitor.visitUse(uses.get(i)); } } if (provides != null) { for (int i = 0, n = provides.size(); i < n; i++) { provides.get(i).accept(moduleVisitor); } } }
Example 6
Source File: ModuleNode.java From JReFrameworker with MIT License | 5 votes |
/** * Makes the given class visitor visit this module. * * @param classVisitor a class visitor. */ public void accept(final ClassVisitor classVisitor) { ModuleVisitor moduleVisitor = classVisitor.visitModule(name, access, version); if (moduleVisitor == null) { return; } if (mainClass != null) { moduleVisitor.visitMainClass(mainClass); } if (packages != null) { for (int i = 0, n = packages.size(); i < n; i++) { moduleVisitor.visitPackage(packages.get(i)); } } if (requires != null) { for (int i = 0, n = requires.size(); i < n; i++) { requires.get(i).accept(moduleVisitor); } } if (exports != null) { for (int i = 0, n = exports.size(); i < n; i++) { exports.get(i).accept(moduleVisitor); } } if (opens != null) { for (int i = 0, n = opens.size(); i < n; i++) { opens.get(i).accept(moduleVisitor); } } if (uses != null) { for (int i = 0, n = uses.size(); i < n; i++) { moduleVisitor.visitUse(uses.get(i)); } } if (provides != null) { for (int i = 0, n = provides.size(); i < n; i++) { provides.get(i).accept(moduleVisitor); } } }