changeset 13560:c95e84b8b1a0

Change addExport to throw exception when caller != this
author alanb
date Sat, 01 Aug 2015 14:28:26 +0100
parents 4fb8c90b5890
children 11021f518613
files src/java.base/share/classes/java/lang/reflect/Module.java test/java/lang/reflect/Proxy/modules/src/test/jdk/test/Main.java test/jdk/jigsaw/reflect/Exports.java
diffstat 3 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/reflect/Module.java	Fri Jul 31 18:50:51 2015 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Module.java	Sat Aug 01 14:28:26 2015 +0100
@@ -503,8 +503,7 @@
         if (isNamed()) {
             Module caller = Reflection.getCallerClass().getModule();
             if (caller != this) {
-                // disable until jtreg and langtools tests are ready
-                // throw new IllegalStateException(caller + " != " + this);
+                throw new IllegalStateException(caller + " != " + this);
             }
             implAddExports(pn, target, true);
         }
--- a/test/java/lang/reflect/Proxy/modules/src/test/jdk/test/Main.java	Fri Jul 31 18:50:51 2015 +0100
+++ b/test/java/lang/reflect/Proxy/modules/src/test/jdk/test/Main.java	Sat Aug 01 14:28:26 2015 +0100
@@ -56,10 +56,11 @@
             ptest.test(d.module, d.loader, d.interfaces);
         }
 
-        for (Data d : proxiesWtihAddExports()) {
-            System.out.println(d);
-            ptest.test(d.module, d.loader, d.interfaces);
-        }
+        // Disabled until we see if this test is needed
+        //for (Data d : proxiesWtihAddExports()) {
+        //    System.out.println(d);
+        //    ptest.test(d.module, d.loader, d.interfaces);
+        //}
     }
 
     static class Data {
--- a/test/jdk/jigsaw/reflect/Exports.java	Fri Jul 31 18:50:51 2015 +0100
+++ b/test/jdk/jigsaw/reflect/Exports.java	Sat Aug 01 14:28:26 2015 +0100
@@ -61,7 +61,7 @@
     /**
      * Exercise Module#addExports with parameters that make it a no-op.
      */
-    @Test
+    @Test(enabled=false)
     public void testNoopAddExports() {
         Module thisModule = this.getClass().getModule();
         Module baseModule = Object.class.getModule();
@@ -81,7 +81,7 @@
      * Exercise Module#addExports to export a package from a named module to
      * an unnamed module.
      */
-    @Test
+    @Test(enabled=false)
     public void testAddExportsToUnamed() throws Exception {
         Module thisModule = this.getClass().getModule();
         Module baseModule = Object.class.getModule();
@@ -100,14 +100,14 @@
     }
 
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test(enabled=false, expectedExceptions = { IllegalArgumentException.class })
     public void testAddExportsWithBadPackage() {
         Module thisModule = this.getClass().getModule();
         Module baseModule = Object.class.getModule();
         baseModule.addExports("jdk.badpackage", thisModule);
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(enabled=false, expectedExceptions = { NullPointerException.class })
     public void testAddExportsToNull() {
         Module baseModule = Object.class.getModule();
         baseModule.addExports("java.lang", null);