RFR: 8170595: Optimize Class.isAnonymousClass

Mandy Chung mandy.chung at oracle.com
Thu Dec 8 03:30:14 UTC 2016

> On Dec 2, 2016, at 6:29 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
> :
> http://cr.openjdk.java.net/~redestad/8170595/webrev.03/
> This brings significant improvements to some variants:

Good to see the significant improvements.

I think what isLocalOrAnonymousClass needs probably is something like this:

  private boolean hasEnclosingMethodInfo() {
      Object[] enclosingInfo = getEnclosingMethod0();
      if (enclosingInfo != null) {
      return enclosingInfo != null;

Then EnclosingMethodInfo doesn’t seem the need to change.  The overall change would be simpler.

As Joe suggests, this worths adding test cases for these methods, if not present.


More information about the core-libs-dev mailing list