Hi Jochen,

On 15/06/2015 3:20 AM, Jochen Theodorou wrote:
Hi all,

this mail is refering to
http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/032733.html
and JDK-8057919

In a groovy program

def cl = { -> '' }
assert cl.class.anonymousClass == false

the open block {->''} is compiled into an inner class. We had problems
with this in the past, because for several reasons we did not follow the
JLS naming conventions here. The change in JDK-8057919 was supposed to
make things better, but the change also means that our open block class
will now have an empty simple name. At the same time reflection tells me
the class is not an anonymous class.

If I see this right, then regardless of if we set the attributes right
or not, reflection and getSimpleName have a differing understanding
about the nature of that class. I consider that a bug. They should have
a common understanding about what a anonymous inner class is, since
getSimpleName is supposed to return an empty string for that case.

Which reflection method are you referring to? Class.isAnonymousClass is defined in terms of getSimpleName():

 public boolean isAnonymousClass() {
    return "".equals(getSimpleName());
 }

David

plus... it would be really really nice if someone could tell me how a
non-anonymous class in a method has to look like with javap, so that I
can know from there if it is no anonymous and finally fix he flags for
Groovy's class generation.

Because javap and the asm lib really don't help much with getting inner
classes and their flags right.

bye jochen

Reply via email to