mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8266530: HotSpot changes for JEP 306
Reviewed-by: dholmes, hseigel
This commit is contained in:
parent
0ae4ceb413
commit
8624cb53cd
6 changed files with 420 additions and 3 deletions
|
@ -2276,7 +2276,7 @@ Method* ClassFileParser::parse_method(const ClassFileStream* const cfs,
|
|||
if (_major_version < 51) { // backward compatibility
|
||||
flags = JVM_ACC_STATIC;
|
||||
} else if ((flags & JVM_ACC_STATIC) == JVM_ACC_STATIC) {
|
||||
flags &= JVM_ACC_STATIC | JVM_ACC_STRICT;
|
||||
flags &= JVM_ACC_STATIC | (_major_version <= JAVA_16_VERSION ? JVM_ACC_STRICT : 0);
|
||||
} else {
|
||||
classfile_parse_error("Method <clinit> is not static in class file %s", THREAD);
|
||||
return NULL;
|
||||
|
@ -4649,6 +4649,7 @@ void ClassFileParser::verify_legal_method_modifiers(jint flags,
|
|||
const bool is_protected = (flags & JVM_ACC_PROTECTED) != 0;
|
||||
const bool major_gte_1_5 = _major_version >= JAVA_1_5_VERSION;
|
||||
const bool major_gte_8 = _major_version >= JAVA_8_VERSION;
|
||||
const bool major_gte_17 = _major_version >= JAVA_17_VERSION;
|
||||
const bool is_initializer = (name == vmSymbols::object_initializer_name());
|
||||
|
||||
bool is_illegal = false;
|
||||
|
@ -4667,7 +4668,7 @@ void ClassFileParser::verify_legal_method_modifiers(jint flags,
|
|||
// ACC_STRICT, or ACC_SYNCHRONIZED flags set. No need to
|
||||
// check for ACC_FINAL, ACC_NATIVE or ACC_SYNCHRONIZED as
|
||||
// those flags are illegal irrespective of ACC_ABSTRACT being set or not.
|
||||
(is_abstract && (is_private || is_static || is_strict))) {
|
||||
(is_abstract && (is_private || is_static || (!major_gte_17 && is_strict)))) {
|
||||
is_illegal = true;
|
||||
}
|
||||
} else if (major_gte_1_5) {
|
||||
|
@ -4694,7 +4695,7 @@ void ClassFileParser::verify_legal_method_modifiers(jint flags,
|
|||
} else { // not initializer
|
||||
if (is_abstract) {
|
||||
if ((is_final || is_native || is_private || is_static ||
|
||||
(major_gte_1_5 && (is_synchronized || is_strict)))) {
|
||||
(major_gte_1_5 && (is_synchronized || (!major_gte_17 && is_strict))))) {
|
||||
is_illegal = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue