134 135 if (!Files.exists(pluginFile)) { 136 throw new AssertionError("Custom plugin not called"); 137 } 138 } 139 140 private void testModuleVerification(Helper helper, Path pluginModulePath) throws IOException { 141 { 142 // dependent module missing check 143 String moduleName = "bar"; // 8147491 144 Path jmodFoo = helper.generateDefaultJModule("foo").assertSuccess(); 145 Path jmodBar = helper.generateDefaultJModule(moduleName, "foo").assertSuccess(); 146 // rogue filter removes "foo" module resources which are 147 // required by "bar" module. Module checks after plugin 148 // application should detect and report error. 149 JImageGenerator.getJLinkTask() 150 .modulePath(helper.defaultModulePath()) 151 .pluginModulePath(pluginModulePath) 152 .output(helper.createNewImageDir(moduleName)) 153 .addMods(moduleName) 154 .option("--rogue-filter") 155 .option("/foo/") 156 .call() 157 .assertFailure("java.lang.module.ResolutionException"); 158 } 159 160 { 161 // package exported by one module used as concealed package 162 // in another module. But, module-info.class is not updated! 163 String moduleName = "jdk.scripting.nashorn"; 164 JImageGenerator.getJLinkTask() 165 .modulePath(helper.defaultModulePath()) 166 .pluginModulePath(pluginModulePath) 167 .output(helper.createNewImageDir(moduleName)) 168 .addMods(moduleName) 169 // "java.logging" includes a package 'javax.script' 170 // which is an exported package from "java.scripting" module! 171 // module-info.class of java.logging left "as is". 172 .option("--rogue-adder") 173 .option("/java.logging/javax/script/Foo.class") | 134 135 if (!Files.exists(pluginFile)) { 136 throw new AssertionError("Custom plugin not called"); 137 } 138 } 139 140 private void testModuleVerification(Helper helper, Path pluginModulePath) throws IOException { 141 { 142 // dependent module missing check 143 String moduleName = "bar"; // 8147491 144 Path jmodFoo = helper.generateDefaultJModule("foo").assertSuccess(); 145 Path jmodBar = helper.generateDefaultJModule(moduleName, "foo").assertSuccess(); 146 // rogue filter removes "foo" module resources which are 147 // required by "bar" module. Module checks after plugin 148 // application should detect and report error. 149 JImageGenerator.getJLinkTask() 150 .modulePath(helper.defaultModulePath()) 151 .pluginModulePath(pluginModulePath) 152 .output(helper.createNewImageDir(moduleName)) 153 .addMods(moduleName) 154 .option("--disable-plugin") 155 .option("release-info") 156 .option("--rogue-filter") 157 .option("/foo/") 158 .call() 159 .assertFailure("java.lang.module.ResolutionException"); 160 } 161 162 { 163 // package exported by one module used as concealed package 164 // in another module. But, module-info.class is not updated! 165 String moduleName = "jdk.scripting.nashorn"; 166 JImageGenerator.getJLinkTask() 167 .modulePath(helper.defaultModulePath()) 168 .pluginModulePath(pluginModulePath) 169 .output(helper.createNewImageDir(moduleName)) 170 .addMods(moduleName) 171 // "java.logging" includes a package 'javax.script' 172 // which is an exported package from "java.scripting" module! 173 // module-info.class of java.logging left "as is". 174 .option("--rogue-adder") 175 .option("/java.logging/javax/script/Foo.class") |