mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
8030221: Checking for anonymous class should check for NULL as well as potential nesting
Store the first non-anonymous class as the host when defining the anonymous class so don't need look for it later. Reviewed-by: dholmes, lfoltan
This commit is contained in:
parent
e3c3a54f7a
commit
2a74c06b8d
3 changed files with 104 additions and 5 deletions
|
@ -861,6 +861,13 @@ Unsafe_DefineAnonymousClass_impl(JNIEnv *env,
|
|||
}
|
||||
|
||||
const Klass* host_klass = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(host_class));
|
||||
|
||||
// Make sure it's the real host class, not another anonymous class.
|
||||
while (host_klass != NULL && host_klass->is_instance_klass() &&
|
||||
InstanceKlass::cast(host_klass)->is_anonymous()) {
|
||||
host_klass = InstanceKlass::cast(host_klass)->host_klass();
|
||||
}
|
||||
|
||||
// Primitive types have NULL Klass* fields in their java.lang.Class instances.
|
||||
if (host_klass == NULL) {
|
||||
THROW_0(vmSymbols::java_lang_IllegalArgumentException());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue