mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +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
|
@ -660,11 +660,13 @@ bool Reflection::verify_field_access(const Klass* current_class,
|
|||
}
|
||||
|
||||
const Klass* host_class = current_class;
|
||||
while (host_class->is_instance_klass() &&
|
||||
InstanceKlass::cast(host_class)->is_anonymous()) {
|
||||
const Klass* next_host_class = InstanceKlass::cast(host_class)->host_klass();
|
||||
if (next_host_class == NULL) break;
|
||||
host_class = next_host_class;
|
||||
if (host_class->is_instance_klass() &&
|
||||
InstanceKlass::cast(host_class)->is_anonymous()) {
|
||||
host_class = InstanceKlass::cast(host_class)->host_klass();
|
||||
assert(host_class != NULL, "Anonymous class has null host class");
|
||||
assert(!(host_class->is_instance_klass() &&
|
||||
InstanceKlass::cast(host_class)->is_anonymous()),
|
||||
"host_class should not be anonymous");
|
||||
}
|
||||
if (host_class == field_class) {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue