On 2016-12-08 04:30, Mandy Chung wrote:
On Dec 2, 2016, at 6:29 AM, Claes Redestad <[email protected]> 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) {
EnclosingMethodInfo.validate(enclosingInfo);
}
return enclosingInfo != null;
}
Then EnclosingMethodInfo doesn’t seem the need to change. The overall change
would be simpler.
Adding hasEnclosingMethodInfo has some descriptive value, but we'd still
need to change EnclosingMethodInfo a bit to separate the validation from
the constructor.
As Joe suggests, this worths adding test cases for these methods, if not
present.
I was also concerned about the lack of explicit tests for this under
jdk/test, but found what
seemed like comprehensive tests in langtools, EnclosingMethodTest.java
in particular.
However, it seems adding a straightforward, minimal test inspired by
other tests under
java/lang/Class wouldn't hurt to ensure completeness and some more local
coverage, so
I made an attempt at this:
http://cr.openjdk.java.net/~redestad/8170595/webrev.04/
Thanks!
/Claes
Mandy