On Tue, 16 Mar 2021 22:24:55 GMT, Joe Darcy <da...@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.

This pull request has now been integrated.

Changeset: 26234b53
Author:    Joe Darcy <da...@openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/26234b53
Stats:     10 lines in 1 file changed: 3 ins; 1 del; 6 mod

8254979: Class.getSimpleName() returns non-empty for lambda and method

Reviewed-by: rriggs, mchung

-------------

PR: https://git.openjdk.java.net/jdk/pull/3038

Reply via email to