< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/ConstantPoolSubstitutionsTests.java

Print this page
rev 51958 : 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
Reviewed-by: alanb, dfuchs, kvn

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -73,11 +73,12 @@
         }
         return graph;
     }
 
     private static Object getConstantPoolForObject() {
-        String miscPackage = Java8OrEarlier ? "sun.misc" : "jdk.internal.misc";
+        String miscPackage = Java8OrEarlier ? "sun.misc"
+            : (Java11OrEarlier ? "jdk.internal.misc" : "jdk.internal.access");
         try {
             Class<?> sharedSecretsClass = Class.forName(miscPackage + ".SharedSecrets");
             Class<?> javaLangAccessClass = Class.forName(miscPackage + ".JavaLangAccess");
             Object jla = sharedSecretsClass.getDeclaredMethod("getJavaLangAccess").invoke(null);
             return javaLangAccessClass.getDeclaredMethod("getConstantPool", Class.class).invoke(jla, Object.class);

@@ -112,11 +113,14 @@
     private static void addExports(Class<?> c) {
         if (!Java8OrEarlier) {
             Object javaBaseModule = JLModule.fromClass(String.class);
             Object cModule = JLModule.fromClass(c);
             uncheckedAddExports(javaBaseModule, "jdk.internal.reflect", cModule);
-            uncheckedAddExports(javaBaseModule, "jdk.internal.misc", cModule);
+            if (Java11OrEarlier)
+                uncheckedAddExports(javaBaseModule, "jdk.internal.misc", cModule);
+            else
+                uncheckedAddExports(javaBaseModule, "jdk.internal.access", cModule);
         }
     }
 
     @Test
     public void testGetSize() {
< prev index next >