3729 // Save the class file name for easier error message printing. 3730 _class_name = (name != NULL) ? name : vmSymbols::unknown_class_name(); 3731 3732 cfs->guarantee_more(8, CHECK_(nullHandle)); // magic, major, minor 3733 // Magic value 3734 u4 magic = cfs->get_u4_fast(); 3735 guarantee_property(magic == JAVA_CLASSFILE_MAGIC, 3736 "Incompatible magic value %u in class file %s", 3737 magic, CHECK_(nullHandle)); 3738 3739 // Version numbers 3740 u2 minor_version = cfs->get_u2_fast(); 3741 u2 major_version = cfs->get_u2_fast(); 3742 3743 // Check version numbers - we check this even with verifier off 3744 if (!is_supported_version(major_version, minor_version)) { 3745 if (name == NULL) { 3746 Exceptions::fthrow( 3747 THREAD_AND_LOCATION, 3748 vmSymbols::java_lang_UnsupportedClassVersionError(), 3749 "Unsupported major.minor version %u.%u", 3750 major_version, 3751 minor_version); 3752 } else { 3753 ResourceMark rm(THREAD); 3754 Exceptions::fthrow( 3755 THREAD_AND_LOCATION, 3756 vmSymbols::java_lang_UnsupportedClassVersionError(), 3757 "%s : Unsupported major.minor version %u.%u", 3758 name->as_C_string(), 3759 major_version, 3760 minor_version); 3761 } 3762 return nullHandle; 3763 } 3764 3765 _major_version = major_version; 3766 _minor_version = minor_version; 3767 3768 3769 // Check if verification needs to be relaxed for this class file 3770 // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376) 3771 _relax_verify = Verifier::relax_verify_for(class_loader()); 3772 3773 // Constant pool 3774 constantPoolHandle cp = parse_constant_pool(CHECK_(nullHandle)); 3775 3776 int cp_size = cp->length(); 3777 3778 cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len 3779 3780 // Access flags | 3729 // Save the class file name for easier error message printing. 3730 _class_name = (name != NULL) ? name : vmSymbols::unknown_class_name(); 3731 3732 cfs->guarantee_more(8, CHECK_(nullHandle)); // magic, major, minor 3733 // Magic value 3734 u4 magic = cfs->get_u4_fast(); 3735 guarantee_property(magic == JAVA_CLASSFILE_MAGIC, 3736 "Incompatible magic value %u in class file %s", 3737 magic, CHECK_(nullHandle)); 3738 3739 // Version numbers 3740 u2 minor_version = cfs->get_u2_fast(); 3741 u2 major_version = cfs->get_u2_fast(); 3742 3743 // Check version numbers - we check this even with verifier off 3744 if (!is_supported_version(major_version, minor_version)) { 3745 if (name == NULL) { 3746 Exceptions::fthrow( 3747 THREAD_AND_LOCATION, 3748 vmSymbols::java_lang_UnsupportedClassVersionError(), 3749 "Unsupported class file version %u.%u, this Java version only recognizes class file versions up to %u.%u", 3750 major_version, 3751 minor_version, 3752 JAVA_MAX_SUPPORTED_VERSION, 3753 JAVA_MAX_SUPPORTED_MINOR_VERSION); 3754 } else { 3755 ResourceMark rm(THREAD); 3756 Exceptions::fthrow( 3757 THREAD_AND_LOCATION, 3758 vmSymbols::java_lang_UnsupportedClassVersionError(), 3759 "%s has been compiled by a more recent Java version (class file version %u.%u), this Java version only recognizes class file versions up to %u.%u", 3760 name->as_C_string(), 3761 major_version, 3762 minor_version, 3763 JAVA_MAX_SUPPORTED_VERSION, 3764 JAVA_MAX_SUPPORTED_MINOR_VERSION); 3765 } 3766 return nullHandle; 3767 } 3768 3769 _major_version = major_version; 3770 _minor_version = minor_version; 3771 3772 3773 // Check if verification needs to be relaxed for this class file 3774 // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376) 3775 _relax_verify = Verifier::relax_verify_for(class_loader()); 3776 3777 // Constant pool 3778 constantPoolHandle cp = parse_constant_pool(CHECK_(nullHandle)); 3779 3780 int cp_size = cp->length(); 3781 3782 cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len 3783 3784 // Access flags |