mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8187982: Update SourceVersion to mention restricted keywords
Reviewed-by: mcimadamore
This commit is contained in:
parent
24d81d3f2e
commit
5d2a4c319a
3 changed files with 39 additions and 4 deletions
|
@ -216,8 +216,9 @@ public enum SourceVersion {
|
|||
* Character#isJavaIdentifierStart(int)} returns {@code true},
|
||||
* followed only by characters for which {@link
|
||||
* Character#isJavaIdentifierPart(int)} returns {@code true}.
|
||||
* This pattern matches regular identifiers, keywords, and the
|
||||
* literals {@code "true"}, {@code "false"}, and {@code "null"}.
|
||||
* This pattern matches regular identifiers, keywords, restricted
|
||||
* keywords, and the literals {@code "true"}, {@code "false"}, and
|
||||
* {@code "null"}.
|
||||
* The method returns {@code false} for all other strings.
|
||||
*
|
||||
* @param name the string to check
|
||||
|
@ -251,10 +252,13 @@ public enum SourceVersion {
|
|||
* qualified name in the latest source version. Unlike {@link
|
||||
* #isIdentifier isIdentifier}, this method returns {@code false}
|
||||
* for keywords, boolean literals, and the null literal.
|
||||
* This method returns {@code true} for <i>restricted
|
||||
* keywords</i>.
|
||||
*
|
||||
* @param name the string to check
|
||||
* @return {@code true} if this string is a
|
||||
* syntactically valid name, {@code false} otherwise.
|
||||
* @jls 3.9 Keywords
|
||||
* @jls 6.2 Names and Identifiers
|
||||
*/
|
||||
public static boolean isName(CharSequence name) {
|
||||
|
@ -266,11 +270,14 @@ public enum SourceVersion {
|
|||
* qualified name in the given source version. Unlike {@link
|
||||
* #isIdentifier isIdentifier}, this method returns {@code false}
|
||||
* for keywords, boolean literals, and the null literal.
|
||||
* This method returns {@code true} for <i>restricted
|
||||
* keywords</i>.
|
||||
*
|
||||
* @param name the string to check
|
||||
* @param version the version to use
|
||||
* @return {@code true} if this string is a
|
||||
* syntactically valid name, {@code false} otherwise.
|
||||
* @jls 3.9 Keywords
|
||||
* @jls 6.2 Names and Identifiers
|
||||
* @since 9
|
||||
*/
|
||||
|
@ -287,6 +294,8 @@ public enum SourceVersion {
|
|||
/**
|
||||
* Returns whether or not {@code s} is a keyword, boolean literal,
|
||||
* or null literal in the latest source version.
|
||||
* This method returns {@code false} for <i>restricted
|
||||
* keywords</i>.
|
||||
*
|
||||
* @param s the string to check
|
||||
* @return {@code true} if {@code s} is a keyword, or boolean
|
||||
|
@ -302,6 +311,8 @@ public enum SourceVersion {
|
|||
/**
|
||||
* Returns whether or not {@code s} is a keyword, boolean literal,
|
||||
* or null literal in the given source version.
|
||||
* This method returns {@code false} for <i>restricted
|
||||
* keywords</i>.
|
||||
*
|
||||
* @param s the string to check
|
||||
* @param version the version to use
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue