RFR: 8254979: Class.getSimpleName() returns non-empty for lambda and method
Roger Riggs
rriggs at openjdk.java.net
Wed Mar 17 16:32:48 UTC 2021
On Tue, 16 Mar 2021 22:24:55 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> java.lang.Class has a number of methods to return some kind of textual token associated with the class, including a type name, canonical name, simple name, and separately the results of toString().
>
> Bug 8254979 notes that getSimpleName mentions returning the name in source code, but operationally returns a non-null result for synthetic classes, ones without benefit of source code representation. Since it is useful to return a non-null result in such cases, I've updated the spec to mention this case. The names of synthetic classes are not covered by the JLS; using a "$" in such names is customary, but not strictly required. The synthetic classes used to implement lambdas and method references as cited in the bug report include "$"'s.
>
> Looking over the other "getFooName" methods, I don't think they need to be updated to handle this case.
Marked as reviewed by rriggs (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/3038
More information about the core-libs-dev
mailing list