< prev index next >

src/java.base/share/classes/sun/invoke/util/VerifyAccess.java

Print this page
rev 55127 : 8223351: [lworld] Primary mirror and nullable mirror for inline type
Reviewed-by: tbd

@@ -234,11 +234,11 @@
      * reference of a given reference class, is really visible to that class.
      * @param type the supposed type of a member or symbolic reference of refc
      * @param refc the class attempting to make the reference
      */
     public static boolean isTypeVisible(Class<?> type, Class<?> refc) {
-        if (type.asBoxType() == refc.asBoxType()) {
+        if (type.asNullableType() == refc.asNullableType()) {
             return true;  // easy check
         }
         while (type.isArray())  type = type.getComponentType();
         if (type.isPrimitive() || type == Object.class) {
             return true;

@@ -282,10 +282,14 @@
         // type ("type") and then is discarded.  Thus, the worst that can happen to
         // the "child" class loader is that it is bothered to load and report a class
         // that differs from "type"; this happens once due to JVM system dictionary
         // memoization.  And the caller never gets to look at the alternate type binding
         // ("res"), whether it exists or not.
+
+        if (type.isInlineClass()) {
+            type = type.asPrimaryType();
+        }
         final String name = type.getName();
         Class<?> res = java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<>() {
                     public Class<?> run() {
                         try {

@@ -293,11 +297,11 @@
                         } catch (ClassNotFoundException | LinkageError e) {
                             return null; // Assume the class is not found
                         }
                     }
             });
-        return (type.asBoxType() == res);
+        return (type == res);
     }
 
     /**
      * Decide if the given method type, attributed to a member or symbolic
      * reference of a given reference class, is really visible to that class.
< prev index next >