equal
deleted
inserted
replaced
43 import java.util.logging.Logger; |
43 import java.util.logging.Logger; |
44 |
44 |
45 import jdk.internal.org.objectweb.asm.ClassReader; |
45 import jdk.internal.org.objectweb.asm.ClassReader; |
46 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; |
46 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; |
47 import jdk.tools.jlink.internal.plugins.asm.AsmPool; |
47 import jdk.tools.jlink.internal.plugins.asm.AsmPool; |
48 import jdk.tools.jlink.plugin.Pool; |
48 import jdk.tools.jlink.plugin.ModuleEntry; |
49 import jdk.tools.jlink.plugin.Pool.ModuleData; |
49 import jdk.tools.jlink.plugin.ModulePool; |
50 |
50 |
51 public class BasicTest extends AsmPluginTestBase { |
51 public class BasicTest extends AsmPluginTestBase { |
52 |
52 |
53 public static void main(String[] args) throws Exception { |
53 public static void main(String[] args) throws Exception { |
54 if (!isImageBuild()) { |
54 if (!isImageBuild()) { |
59 } |
59 } |
60 |
60 |
61 @Override |
61 @Override |
62 public void test() throws Exception { |
62 public void test() throws Exception { |
63 BasicPlugin basicPlugin = new BasicPlugin(getClasses()); |
63 BasicPlugin basicPlugin = new BasicPlugin(getClasses()); |
64 Pool res = basicPlugin.visit(getPool()); |
64 ModulePool res = basicPlugin.visit(getPool()); |
65 basicPlugin.test(getPool(), res); |
65 basicPlugin.test(getPool(), res); |
66 } |
66 } |
67 |
67 |
68 private class BasicPlugin extends TestPlugin { |
68 private class BasicPlugin extends TestPlugin { |
69 |
69 |
105 throw new UncheckedIOException(ex); |
105 throw new UncheckedIOException(ex); |
106 } |
106 } |
107 } |
107 } |
108 |
108 |
109 @Override |
109 @Override |
110 public void test(Pool inResources, Pool outResources) throws Exception { |
110 public void test(ModulePool inResources, ModulePool outResources) throws Exception { |
111 if (!isVisitCalled()) { |
111 if (!isVisitCalled()) { |
112 throw new AssertionError("Resources not visited"); |
112 throw new AssertionError("Resources not visited"); |
113 } |
113 } |
114 if (inResources.getContent().size() != outResources.getContent().size()) { |
114 if (inResources.getEntryCount() != outResources.getEntryCount()) { |
115 throw new AssertionError("Input size " + inResources.getContent().size() + |
115 throw new AssertionError("Input size " + inResources.getEntryCount() + |
116 " != to " + outResources.getContent().size()); |
116 " != to " + outResources.getEntryCount()); |
117 } |
117 } |
118 } |
118 } |
119 |
119 |
120 private void testVisitor() throws IOException { |
120 private void testVisitor() throws IOException { |
121 List<String> seen = new ArrayList<>(); |
121 List<String> seen = new ArrayList<>(); |
140 } |
140 } |
141 } |
141 } |
142 |
142 |
143 private void testPools() throws IOException { |
143 private void testPools() throws IOException { |
144 Set<String> remain = new HashSet<>(classes); |
144 Set<String> remain = new HashSet<>(classes); |
145 for (ModuleData res : getPools().getGlobalPool().getClasses()) { |
145 for (ModuleEntry res : getPools().getGlobalPool().getClasses()) { |
146 ClassReader reader = getPools().getGlobalPool().getClassReader(res); |
146 ClassReader reader = getPools().getGlobalPool().getClassReader(res); |
147 String className = reader.getClassName(); |
147 String className = reader.getClassName(); |
148 // Wrong naming of module-info.class in ASM |
148 // Wrong naming of module-info.class in ASM |
149 if (className.endsWith("module-info")) { |
149 if (className.endsWith("module-info")) { |
150 continue; |
150 continue; |