SourceVersion (Java SE 10 & JDK 10 ) (original) (raw)
Enum Constant Detail
* #### RELEASE\_0
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_0
The original version. The language described inThe Java™ Language Specification, First Edition.
* #### RELEASE\_1
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_1
The version recognized by the Java Platform 1.1\. The language is `RELEASE_0` augmented with nested classes as described in the 1.1 update toThe Java™ Language Specification, First Edition.
* #### RELEASE\_2
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_2
The version recognized by the Java 2 Platform, Standard Edition, v 1.2\. The language described inThe Java™ Language Specification, Second Edition, which includes the ` strictfp` modifier.
* #### RELEASE\_3
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_3
The version recognized by the Java 2 Platform, Standard Edition, v 1.3\. No major changes from `RELEASE_2`.
* #### RELEASE\_4
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_4
The version recognized by the Java 2 Platform, Standard Edition, v 1.4\. Added a simple assertion facility.
* #### RELEASE\_5
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_5
The version recognized by the Java 2 Platform, Standard Edition 5.0\. The language described inThe Java™ Language Specification, Third Edition. First release to support generics, annotations, autoboxing, var-args, enhanced ` for` loop, and hexadecimal floating-point literals.
* #### RELEASE\_6
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_6
The version recognized by the Java Platform, Standard Edition 6\. No major changes from `RELEASE_5`.
* #### RELEASE\_7
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_7
The version recognized by the Java Platform, Standard Edition 7\. Additions in this release include, diamond syntax for constructors, `try`\-with-resources, strings in switch, binary literals, and multi-catch.
Since:
1.7
* #### RELEASE\_8
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_8
The version recognized by the Java Platform, Standard Edition 8\. Additions in this release include lambda expressions and default methods.
Since:
1.8
* #### RELEASE\_9
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_9
The version recognized by the Java Platform, Standard Edition 9\. Additions in this release include modules and removal of a single underscore from the set of legal identifier names.
Since:
9
* #### RELEASE\_10
public static final [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") RELEASE_10
The version recognized by the Java Platform, Standard Edition 10\. Additions in this release include local-variable type inference (`var`).
Since:
10
Method Detail
* #### values
public static [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model")[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SourceVersion c : SourceVersion.values())
System.out.println(c);
Returns:
an array containing the constants of this enum type, in the order they are declared
* #### valueOf
public static [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") valueOf([String](../../../java/lang/String.html "class in java.lang") name)
Returns the enum constant of this type with the specified name. The string must match _exactly_ an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Parameters:
`name` \- the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
`[IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if this enum type has no constant with the specified name
`[NullPointerException](../../../java/lang/NullPointerException.html "class in java.lang")` \- if the argument is null
* #### latest
public static [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") latest()
Returns the latest source version that can be modeled.
Returns:
the latest source version that can be modeled
* #### latestSupported
public static [SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") latestSupported()
Returns the latest source version fully supported by the current execution environment. `RELEASE_5` or later must be returned.
Returns:
the latest source version that is fully supported
* #### isIdentifier
public static boolean isIdentifier([CharSequence](../../../java/lang/CharSequence.html "interface in java.lang") name)
Returns whether or not `name` is a syntactically valid identifier (simple name) or keyword in the latest source version. The method returns `true` if the name consists of an initial character for which [Character.isJavaIdentifierStart(int)](../../../java/lang/Character.html#isJavaIdentifierStart%28int%29) returns `true`, followed only by characters for which [Character.isJavaIdentifierPart(int)](../../../java/lang/Character.html#isJavaIdentifierPart%28int%29) returns `true`. This pattern matches regular identifiers, keywords, restricted keywords, and the literals `"true"`, `"false"`,`"null"`, and `"var"`. The method returns `false` for all other strings.
Parameters:
`name` \- the string to check
Returns:
`true` if this string is a syntactically valid identifier or keyword, `false` otherwise.
* #### isName
public static boolean isName([CharSequence](../../../java/lang/CharSequence.html "interface in java.lang") name)
Returns whether or not `name` is a syntactically valid qualified name in the latest source version. Unlike [isIdentifier](../../../javax/lang/model/SourceVersion.html#isIdentifier%28java.lang.CharSequence%29), this method returns `false` for keywords, boolean literals, and the null literal. This method returns `true` for _restricted keywords_ and `"var"`.
Parameters:
`name` \- the string to check
Returns:
`true` if this string is a syntactically valid name, `false` otherwise.
See The Java™ Language Specification:
3.9 Keywords, 6.2 Names and Identifiers
* #### isName
public static boolean isName([CharSequence](../../../java/lang/CharSequence.html "interface in java.lang") name,
[SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") version)
Returns whether or not `name` is a syntactically valid qualified name in the given source version. Unlike [isIdentifier](../../../javax/lang/model/SourceVersion.html#isIdentifier%28java.lang.CharSequence%29), this method returns `false` for keywords, boolean literals, and the null literal. This method returns `true` for _restricted keywords_ and `"var"`.
Parameters:
`name` \- the string to check
`version` \- the version to use
Returns:
`true` if this string is a syntactically valid name, `false` otherwise.
Since:
9
See The Java™ Language Specification:
3.9 Keywords, 6.2 Names and Identifiers
* #### isKeyword
public static boolean isKeyword([CharSequence](../../../java/lang/CharSequence.html "interface in java.lang") s)
Returns whether or not `s` is a keyword, boolean literal, or null literal in the latest source version. This method returns `false` for _restricted keywords_ and `"var"`.
Parameters:
`s` \- the string to check
Returns:
`true` if `s` is a keyword, or boolean literal, or null literal, `false` otherwise.
See The Java™ Language Specification:
3.9 Keywords, 3.10.3 Boolean Literals, 3.10.7 The Null Literal
* #### isKeyword
public static boolean isKeyword([CharSequence](../../../java/lang/CharSequence.html "interface in java.lang") s,
[SourceVersion](../../../javax/lang/model/SourceVersion.html "enum in javax.lang.model") version)
Returns whether or not `s` is a keyword, boolean literal, or null literal in the given source version. This method returns `false` for _restricted keywords_ and `"var"`.
Parameters:
`s` \- the string to check
`version` \- the version to use
Returns:
`true` if `s` is a keyword, or boolean literal, or null literal, `false` otherwise.
Since:
9
See The Java™ Language Specification:
3.9 Keywords, 3.10.3 Boolean Literals, 3.10.7 The Null Literal