8169069: Module system implementation refresh (11/2016)

Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Reviewed-by: lfoltan, acorn, ctornqvi, mchung
This commit is contained in:
Alan Bateman 2016-12-01 08:56:41 +00:00
parent 16734f37d5
commit 988690303a
110 changed files with 1885 additions and 773 deletions

View file

@ -35,10 +35,6 @@ public class GetModule {
}
static native Object callGetModule(java.lang.Class clazz);
static native void callAddModuleReads(java.lang.reflect.Module from_module,
java.lang.reflect.Module source_module);
static native boolean callCanReadModule(java.lang.reflect.Module asking_module,
java.lang.reflect.Module source_module);
public static void main(String[] args) {
Module module;
@ -144,71 +140,6 @@ public class GetModule {
} catch(NullPointerException e) {
// Expected
}
// Tests for JNI_AddModuleReads() //
Module javaScriptingModule = javax.script.Bindings.class.getModule();
if (javaScriptingModule == null) {
throw new RuntimeException("Failed to get java.scripting module");
}
Module javaLoggingModule = java.util.logging.Level.class.getModule();
if (javaLoggingModule == null) {
throw new RuntimeException("Failed to get java.logging module");
}
if (callCanReadModule(javaLoggingModule, javaScriptingModule)) {
throw new RuntimeException(
"Expected FALSE because javaLoggingModule cannot read javaScriptingModule");
}
callAddModuleReads(javaLoggingModule, javaScriptingModule);
callAddModuleReads(javaScriptingModule, GetModule.class.getModule()); // unnamed module
try {
callAddModuleReads(null, javaLoggingModule);
throw new RuntimeException(
"Expected NullPointerException for bad from_module not thrown");
} catch(NullPointerException e) {
// expected
}
try {
callAddModuleReads(javaLoggingModule, null);
throw new RuntimeException(
"Expected NullPointerException for bad source_module not thrown");
} catch(NullPointerException e) {
// expected
}
// Tests for JNI_CanReadModule() //
if (!callCanReadModule(javaLoggingModule, javaScriptingModule)) {
throw new RuntimeException(
"Expected TRUE because javaLoggingModule can read javaScriptingModule");
}
if (callCanReadModule(javaBaseModule, javaScriptingModule)) {
throw new RuntimeException(
"Expected FALSE because javaBaseModule cannnot read javaScriptingModule");
}
try {
callCanReadModule(javaLoggingModule, null);
throw new RuntimeException(
"Expected NullPointerException for bad sourceModule not thrown");
} catch(NullPointerException e) {
// expected
}
try {
callCanReadModule(null, javaScriptingModule);
throw new RuntimeException(
"Expected NullPointerException for bad asking_module not thrown");
} catch(NullPointerException e) {
// expected
}
}
static class MyClassLoader extends ClassLoader { }