JDK-8057919 Class.getSimpleName() should work for non-JLS compliant class names
Jochen Theodorou
blackdrag at gmx.org
Sun Jun 14 17:20:13 UTC 2015
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.
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
--
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/
More information about the core-libs-dev
mailing list