8139164: JVM should throw ClassFormatError for non-void methods named <clinit>

If method being parsed is named <clinit>, throw ClassFormatError if it is not void or has arguments, for class file version >= 51.

Reviewed-by: acorn, lfoltan
This commit is contained in:
Harold Seigel 2015-11-10 08:42:53 -05:00
parent fd47033053
commit 3756d55ee6
7 changed files with 173 additions and 19 deletions

View file

@ -2846,7 +2846,7 @@ void ClassVerifier::verify_invoke_instructions(
if (sig_stream.type() != T_VOID) {
if (method_name == vmSymbols::object_initializer_name()) {
// <init> method must have a void return type
/* Unreachable? Class file parser verifies that <init> methods have
/* Unreachable? Class file parser verifies that methods with '<' have
* void return */
verify_error(ErrorContext::bad_code(bci),
"Return type must be void in <init> method");