mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8139069: JVM should throw ClassFormatError for <init> methods in interfaces
If method being parsed is in an interface, throw ClassFormatError if its name is "<init>" Reviewed-by: acorn, lfoltan
This commit is contained in:
parent
5659603602
commit
df9b5759f7
5 changed files with 125 additions and 4 deletions
|
@ -1579,11 +1579,9 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) {
|
|||
return;
|
||||
}
|
||||
// Make sure "this" has been initialized if current method is an
|
||||
// <init>. Note that "<init>" methods in interfaces are just
|
||||
// normal methods. Interfaces cannot have ctors.
|
||||
// <init>.
|
||||
if (_method->name() == vmSymbols::object_initializer_name() &&
|
||||
current_frame.flag_this_uninit() &&
|
||||
!current_class()->is_interface()) {
|
||||
current_frame.flag_this_uninit()) {
|
||||
verify_error(ErrorContext::bad_code(bci),
|
||||
"Constructor must call super() or this() "
|
||||
"before return");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue