RFR(S) 8030221: Checking for anonymous class should check for NULL as well as potential nesting

David Holmes david.holmes at oracle.com
Tue Aug 16 03:26:01 UTC 2016


Hi Harold,

On 16/08/2016 5:34 AM, harold seigel wrote:
> Hi,
>
> Please review this fix for JDK-8030221.  The fix makes sure that, if the
> specified host class for a VM anonymous is another anonymous class, that
> the actual host class is the specified host class's host class.  For
> example, if named class N is the host class for anonymous class A1, and
> A1 is the specified host class for anonymous class A2, then the actual
> host class for A2 will be named class N.
>
> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8030221
>
> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8030221/

So basically instead of storing an anonymous class as host and later 
walking through to find the first non-anonymous "host" class, you now 
store the first non-anonymous class as the host and so don't need to 
walk later. Ok.

src/share/vm/runtime/reflection.cpp

I find this assertion:

  assert(!host_class->is_instance_klass() ||
         !InstanceKlass::cast(host_class)->is_anonymous(),
          "host_class should not be anonymous");

somewhat hard to understand compared to the more direct:

  assert( !(host_class->is_instance_klass() &&
            InstanceKlass::cast(host_class)->is_anonymous()),
          "host_class should not be anonymous");

Thanks,
David

> The fix was tested with the JCK Lang and VM tests, the hotpot, and
> java/lang, java/util and other JTreg tests, the NSK quick tests, and
> with the RBT runtime nightly tests.
>
> Thanks, Harold


More information about the hotspot-runtime-dev mailing list