Skip to content

Commit 26234b5

Browse files
committed
8254979: Class.getSimpleName() returns non-empty for lambda and method
Reviewed-by: rriggs, mchung
1 parent 83a49ef commit 26234b5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/java.base/share/classes/java/lang/Class.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -779,10 +779,9 @@ public boolean isAnnotation() {
779779
}
780780

781781
/**
782-
* Returns {@code true} if and only if this class has the synthetic modifier
783-
* bit set.
782+
*{@return {@code true} if and only if this class has the synthetic modifier
783+
* bit set}
784784
*
785-
* @return {@code true} if and only if this class has the synthetic modifier bit set
786785
* @jls 13.1 The Form of a Binary
787786
* @jvms 4.1 The {@code ClassFile} Structure
788787
* @since 1.5
@@ -1620,12 +1619,15 @@ public Class<?> getEnclosingClass() throws SecurityException {
16201619

16211620
/**
16221621
* Returns the simple name of the underlying class as given in the
1623-
* source code. Returns an empty string if the underlying class is
1624-
* anonymous.
1622+
* source code. An empty string is returned if the underlying class is
1623+
* {@linkplain #isAnonymousClass() anonymous}.
1624+
* A {@linkplain #isSynthetic() synthetic class}, one not present
1625+
* in source code, can have a non-empty name including special
1626+
* characters, such as "{@code $}".
16251627
*
1626-
* <p>The simple name of an array is the simple name of the
1628+
* <p>The simple name of an {@linkplain isArray() array class} is the simple name of the
16271629
* component type with "[]" appended. In particular the simple
1628-
* name of an array whose component type is anonymous is "[]".
1630+
* name of an array class whose component type is anonymous is "[]".
16291631
*
16301632
* @return the simple name of the underlying class
16311633
* @since 1.5

0 commit comments

Comments
 (0)