< prev index next >

jdk/src/java.base/share/classes/java/lang/Class.java

Print this page

        

@@ -78,10 +78,12 @@
 import sun.reflect.generics.repository.ConstructorRepository;
 import sun.reflect.generics.scope.ClassScope;
 import sun.security.util.SecurityConstants;
 import sun.reflect.annotation.*;
 import sun.reflect.misc.ReflectUtil;
+import valhalla.shady.MinimalValueTypes_1_0;
+
 import static valhalla.shady.MinimalValueTypes_1_0.ACC_VALUE;
 
 /**
  * Instances of the class {@code Class} represent classes and
  * interfaces in a running Java application.  An enum is a kind of

@@ -461,17 +463,22 @@
 
         return c != null && !c.isValueClass() ? c : null;
     }
 
     boolean isValueClass() {
+        // ensure that system properties have been initialized.
+        if (VM.initLevel() < 1)
+            return false;
+
         Class<?> c = this;
         while (c.isArray()) {
             c = c.getComponentType();
         }
 
         // For now, check if it is a subtype of __Value
-        return __Value.class.isAssignableFrom(c) && c != __Value.class;
+        Class<?> valueBaseClass = MinimalValueTypes_1_0.getValueClass();
+        return valueBaseClass != null && c != valueBaseClass && valueBaseClass.isAssignableFrom(c);
     }
 
     private void ensureNotValueClass() {
         // temporary workaround until compiler/valhalla/valuetypes/ValueTypeBenchTest.java
         // is updated to do reflection on VCC instead of VVT declared with __ByValue
< prev index next >