< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 3050,3060 **** if (_need_verify) { guarantee_property(inner_class_info_index != outer_class_info_index, "Class is both outer and inner class in class file %s", CHECK_0); } // Access flags ! jint flags = cfs->get_u2_fast() & RECOGNIZED_INNER_CLASS_MODIFIERS; if ((flags & JVM_ACC_INTERFACE) && _major_version < JAVA_6_VERSION) { // Set abstract bit for old class files for backward compatibility flags |= JVM_ACC_ABSTRACT; } verify_legal_class_modifiers(flags, CHECK_0); --- 3050,3074 ---- if (_need_verify) { guarantee_property(inner_class_info_index != outer_class_info_index, "Class is both outer and inner class in class file %s", CHECK_0); } // Access flags ! jint flags; ! // Don't allow JVM_ACC_MODULE in JDK-9 and later. ! if (_major_version >= JAVA_9_VERSION) { ! flags = cfs->get_u2_fast() & (RECOGNIZED_INNER_CLASS_MODIFIERS | JVM_ACC_MODULE); ! if (flags & JVM_ACC_MODULE) { ! ResourceMark rm(THREAD); ! Exceptions::fthrow( ! THREAD_AND_LOCATION, ! vmSymbols::java_lang_NoClassDefFoundError(), ! "Illegal ACC_MODULE class modifier in class %s", ! _class_name->as_C_string()); ! } ! } else { ! flags = cfs->get_u2_fast() & RECOGNIZED_INNER_CLASS_MODIFIERS; ! } if ((flags & JVM_ACC_INTERFACE) && _major_version < JAVA_6_VERSION) { // Set abstract bit for old class files for backward compatibility flags |= JVM_ACC_ABSTRACT; } verify_legal_class_modifiers(flags, CHECK_0);
*** 4530,4547 **** const bool is_abstract = (flags & JVM_ACC_ABSTRACT) != 0; const bool is_final = (flags & JVM_ACC_FINAL) != 0; const bool is_super = (flags & JVM_ACC_SUPER) != 0; const bool is_enum = (flags & JVM_ACC_ENUM) != 0; const bool is_annotation = (flags & JVM_ACC_ANNOTATION) != 0; ! const bool is_module_info= (flags & JVM_ACC_MODULE) != 0; const bool major_gte_15 = _major_version >= JAVA_1_5_VERSION; if ((is_abstract && is_final) || (is_interface && !is_abstract) || (is_interface && major_gte_15 && (is_super || is_enum)) || ! (!is_interface && major_gte_15 && is_annotation) || ! is_module_info) { ResourceMark rm(THREAD); Exceptions::fthrow( THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(), "Illegal class modifiers in class %s: 0x%X", --- 4544,4561 ---- const bool is_abstract = (flags & JVM_ACC_ABSTRACT) != 0; const bool is_final = (flags & JVM_ACC_FINAL) != 0; const bool is_super = (flags & JVM_ACC_SUPER) != 0; const bool is_enum = (flags & JVM_ACC_ENUM) != 0; const bool is_annotation = (flags & JVM_ACC_ANNOTATION) != 0; ! const bool is_module = (flags & JVM_ACC_MODULE) != 0; const bool major_gte_15 = _major_version >= JAVA_1_5_VERSION; + assert(!is_module, "JVM_ACC_MODULE should not be set"); if ((is_abstract && is_final) || (is_interface && !is_abstract) || (is_interface && major_gte_15 && (is_super || is_enum)) || ! (!is_interface && major_gte_15 && is_annotation)) { ResourceMark rm(THREAD); Exceptions::fthrow( THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(), "Illegal class modifiers in class %s: 0x%X",
*** 5732,5742 **** // ACCESS FLAGS stream->guarantee_more(8, CHECK); // flags, this_class, super_class, infs_len // Access flags ! jint flags = stream->get_u2_fast() & JVM_RECOGNIZED_CLASS_MODIFIERS; if ((flags & JVM_ACC_INTERFACE) && _major_version < JAVA_6_VERSION) { // Set abstract bit for old class files for backward compatibility flags |= JVM_ACC_ABSTRACT; } --- 5746,5770 ---- // ACCESS FLAGS stream->guarantee_more(8, CHECK); // flags, this_class, super_class, infs_len // Access flags ! jint flags; ! // Don't allow JVM_ACC_MODULE in JDK-9 and later. ! if (_major_version >= JAVA_9_VERSION) { ! flags = stream->get_u2_fast() & (JVM_RECOGNIZED_CLASS_MODIFIERS | JVM_ACC_MODULE); ! if (flags & JVM_ACC_MODULE) { ! ResourceMark rm(THREAD); ! Exceptions::fthrow( ! THREAD_AND_LOCATION, ! vmSymbols::java_lang_NoClassDefFoundError(), ! "Illegal ACC_MODULE class modifier in class %s", ! _class_name->as_C_string()); ! } ! } else { ! flags = stream->get_u2_fast() & JVM_RECOGNIZED_CLASS_MODIFIERS; ! } if ((flags & JVM_ACC_INTERFACE) && _major_version < JAVA_6_VERSION) { // Set abstract bit for old class files for backward compatibility flags |= JVM_ACC_ABSTRACT; }
< prev index next >