6845426: non-static <clinit> method with no args is called during the class initialization process

Only call <clinit> with ACC_STATIC for classfiles with version > 50

Reviewed-by: acorn, dholmes, coleenp
This commit is contained in:
Keith McGuigan 2011-03-04 14:40:46 -05:00
parent 3ebf2446ee
commit fac0855180
5 changed files with 37 additions and 7 deletions

View file

@ -1616,8 +1616,13 @@ methodHandle ClassFileParser::parse_method(constantPoolHandle cp, bool is_interf
AccessFlags access_flags;
if (name == vmSymbols::class_initializer_name()) {
// We ignore the access flags for a class initializer. (JVM Spec. p. 116)
flags = JVM_ACC_STATIC;
// We ignore the other access flags for a valid class initializer.
// (JVM Spec 2nd ed., chapter 4.6)
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;
}
} else {
verify_legal_method_modifiers(flags, is_interface, name, CHECK_(nullHandle));
}