mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8243583: Change 'final' error checks to throw ICCE
Reviewed-by: lfoltan, dholmes
This commit is contained in:
parent
1f00c3b9ba
commit
3bd5b80761
4 changed files with 20 additions and 29 deletions
|
@ -4438,13 +4438,7 @@ void ClassFileParser::check_super_class_access(const InstanceKlass* this_klass,
|
|||
const InstanceKlass* super_ik = InstanceKlass::cast(super);
|
||||
|
||||
if (super->is_final()) {
|
||||
ResourceMark rm(THREAD);
|
||||
Exceptions::fthrow(
|
||||
THREAD_AND_LOCATION,
|
||||
vmSymbols::java_lang_VerifyError(),
|
||||
"class %s cannot inherit from final class %s",
|
||||
this_klass->external_name(),
|
||||
super_ik->external_name());
|
||||
classfile_icce_error("class %s cannot inherit from final class %s", super_ik, THREAD);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4589,15 +4583,12 @@ static void check_final_method_override(const InstanceKlass* this_klass, TRAPS)
|
|||
if (can_access) {
|
||||
// this class can access super final method and therefore override
|
||||
ResourceMark rm(THREAD);
|
||||
Exceptions::fthrow(THREAD_AND_LOCATION,
|
||||
vmSymbols::java_lang_VerifyError(),
|
||||
"class %s overrides final method %s.%s%s",
|
||||
this_klass->external_name(),
|
||||
super_m->method_holder()->external_name(),
|
||||
name->as_C_string(),
|
||||
signature->as_C_string()
|
||||
);
|
||||
return;
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(),
|
||||
err_msg("class %s overrides final method %s.%s%s",
|
||||
this_klass->external_name(),
|
||||
super_m->method_holder()->external_name(),
|
||||
name->as_C_string(),
|
||||
signature->as_C_string()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue