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.

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

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

Changes: https://git.openjdk.java.net/jdk/pull/3038/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3038&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8254979
  Stats: 10 lines in 1 file changed: 3 ins; 1 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3038.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3038/head:pull/3038

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

Reply via email to