< prev index next >

src/java.base/share/classes/java/lang/reflect/Field.java

Print this page
rev 55117 : 8223350: [lworld] Use inline classes instead of value classes

@@ -166,16 +166,15 @@
     @Override
     @CallerSensitive
     public void setAccessible(boolean flag) {
         AccessibleObject.checkPermission();
 
-        if (flag) {
             if (clazz.isValue()) {
-                throw new InaccessibleObjectException(
-                    "Unable to make a value class field \"" + this + "\" accessible");
+            throw new InaccessibleObjectException("cannot make a field accessible of inline class "
+                    + clazz.getName());
             }
-
+        if (flag) {
             checkCanSetAccessible(Reflection.getCallerClass());
         }
         setAccessible0(flag);
     }
 

@@ -1103,15 +1102,15 @@
                     Modifier.isStatic(modifiers) ? null : obj.getClass(),
                     modifiers);
     }
 
     /*
-     * Ensure the declaring class is not a value class.
+     * Ensure the declaring class is not an inline class.
      */
     private void ensureNotValueClass() throws IllegalAccessException {
         if (clazz.isValue()) {
-            throw new IllegalAccessException("cannot set this field of a value class "
+            throw new IllegalAccessException("cannot set field \"" + this + "\" of inline class "
                 + clazz.getName());
         }
     }
 
     // security check is done before calling this method
< prev index next >