Mercurial > hg > truffle
diff src/share/vm/classfile/classFileParser.cpp @ 2334:dbad0519a1c4
6845426: non-static <clinit> method with no args is called during the class initialization process
Summary: Only call <clinit> with ACC_STATIC for classfiles with version > 50
Reviewed-by: acorn, dholmes, coleenp
author | kamg |
---|---|
date | Fri, 04 Mar 2011 14:40:46 -0500 |
parents | c5a923563727 |
children | 72dee110246f |
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp Thu Mar 03 19:53:03 2011 -0500 +++ b/src/share/vm/classfile/classFileParser.cpp Fri Mar 04 14:40:46 2011 -0500 @@ -1616,8 +1616,13 @@ 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)); }