Mercurial > hg > truffle
diff src/share/vm/oops/methodOop.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 | a97fd181b813 |
children | 72dee110246f |
line wrap: on
line diff
--- a/src/share/vm/oops/methodOop.cpp Thu Mar 03 19:53:03 2011 -0500 +++ b/src/share/vm/oops/methodOop.cpp Fri Mar 04 14:40:46 2011 -0500 @@ -466,7 +466,20 @@ bool methodOopDesc::is_initializer() const { - return name() == vmSymbols::object_initializer_name() || name() == vmSymbols::class_initializer_name(); + return name() == vmSymbols::object_initializer_name() || is_static_initializer(); +} + +bool methodOopDesc::has_valid_initializer_flags() const { + return (is_static() || + instanceKlass::cast(method_holder())->major_version() < 51); +} + +bool methodOopDesc::is_static_initializer() const { + // For classfiles version 51 or greater, ensure that the clinit method is + // static. Non-static methods with the name "<clinit>" are not static + // initializers. (older classfiles exempted for backward compatibility) + return name() == vmSymbols::class_initializer_name() && + has_valid_initializer_flags(); }