< prev index next >

src/hotspot/share/classfile/classFileParser.cpp

Print this page

        

@@ -3484,19 +3484,22 @@
       }
       inner_classes_attribute_start = cfs->current();
       inner_classes_attribute_length = attribute_length;
       cfs->skip_u1(inner_classes_attribute_length, CHECK);
     } else if (tag == vmSymbols::tag_value_types()) {
+      // Ignore ValueTypes attribute unless value type support is enabled.
+      if (supports_value_types())  {
       // Check for ValueTypes tag
       if (parsed_value_types_attribute) {
         classfile_parse_error("Multiple ValueTypes attributes in class file %s", CHECK);
       } else {
         parsed_value_types_attribute = true;
       }
       value_types_attribute_start = cfs->current();
       value_types_attribute_length = attribute_length;
-      cfs->skip_u1(value_types_attribute_length, CHECK);
+      }
+      cfs->skip_u1(attribute_length, CHECK);
     } else if (tag == vmSymbols::tag_synthetic()) {
       // Check for Synthetic tag
       // Shouldn't we check that the synthetic flags wasn't already set? - not required in spec
       if (attribute_length != 0) {
         classfile_parse_error(

@@ -4699,11 +4702,11 @@
   }
 }
 
 bool ClassFileParser::supports_value_types() const {
   // Value types are only supported by class file version 55 and later
-  return _major_version >= JAVA_11_VERSION;
+  return EnableValhalla && _major_version >= JAVA_11_VERSION;
 }
 
 // Attach super classes and interface classes to class loader data
 static void record_defined_class_dependencies(const InstanceKlass* defined_klass,
                                               TRAPS) {
< prev index next >