Package Summary  Overview Summary

class:SourceVersion [CHANGED]

All Implemented Interfaces:
Serializable, Comparable<SourceVersion>, Constable

public enum SourceVersion
extends Enum<SourceVersion>
Source versions of the Java™Java programming language. See the appropriate edition of The Java™Java Language Specification for information about a particular source version.

Note that additional source version constants will be added to model future releases of the language.

Since:
1.6
All Implemented Interfaces:
Serializable, Comparable<SourceVersion>, Constable

public enum SourceVersion
extends Enum<SourceVersion>
Source versions of the Java™ programming language. See the appropriate edition of The Java™ Language Specification for information about a particular source version.

Note that additional source version constants will be added to model future releases of the language.

Since:
1.6
All Implemented Interfaces:
Serializable, Comparable<SourceVersion>, Constable

public enum SourceVersion
extends Enum<SourceVersion>
Source versions of the Java programming language. See the appropriate edition of The Java Language Specification for information about a particular source version.

Note that additional source version constants will be added to model future releases of the language.

Since:
1.6

field:RELEASE_0 [CHANGED]

  • RELEASE_0

    public static final  SourceVersion RELEASE_0
    The original version. The language described in The Java™Java Language Specification, First Edition .
  • RELEASE_0

    public static final  SourceVersion RELEASE_0
    The original version. The language described in The Java™ Language Specification, First Edition .
  • RELEASE_0

    public static final  SourceVersion RELEASE_0
    The original version. The language described in The Java Language Specification, First Edition .
  • field:RELEASE_1 [CHANGED]

    RELEASE_1

    public static final  SourceVersion 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 to The Java™Java Language Specification, First Edition .

    RELEASE_1

    public static final  SourceVersion 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 to The Java™ Language Specification, First Edition .

    RELEASE_1

    public static final  SourceVersion 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 to The Java Language Specification, First Edition .

    field:RELEASE_2 [CHANGED]

    RELEASE_2

    public static final  SourceVersion RELEASE_2
    The version recognized by the Java 2 Platform, Standard Edition, v 1.2. The language described in The Java™Java Language Specification, Second Edition , which includes the strictfp modifier.

    RELEASE_2

    public static final  SourceVersion RELEASE_2
    The version recognized by the Java 2 Platform, Standard Edition, v 1.2. The language described in The Java™ Language Specification, Second Edition , which includes the strictfp modifier.

    RELEASE_2

    public static final  SourceVersion RELEASE_2
    The version recognized by the Java 2 Platform, Standard Edition, v 1.2. The language described in The Java Language Specification, Second Edition , which includes the strictfp modifier.

    field:RELEASE_3 [NONE]

    RELEASE_3

    public static final  SourceVersion RELEASE_3
    The version recognized by the Java 2 Platform, Standard Edition, v 1.3. No major changes from RELEASE_2.

    field:RELEASE_4 [NONE]

    RELEASE_4

    public static final  SourceVersion RELEASE_4
    The version recognized by the Java 2 Platform, Standard Edition, v 1.4. Added a simple assertion facility.

    field:RELEASE_5 [CHANGED]

    RELEASE_5

    public static final  SourceVersion RELEASE_5
    The version recognized by the Java 2 Platform, Standard Edition 5.0. The language described in The Java™Java Language Specification, Third Edition . First release to support generics, annotations, autoboxing, var-args, enhanced for loop, and hexadecimal floating-point literals.

    RELEASE_5

    public static final  SourceVersion RELEASE_5
    The version recognized by the Java 2 Platform, Standard Edition 5.0. The language described in The Java™ Language Specification, Third Edition . First release to support generics, annotations, autoboxing, var-args, enhanced for loop, and hexadecimal floating-point literals.

    RELEASE_5

    public static final  SourceVersion RELEASE_5
    The version recognized by the Java 2 Platform, Standard Edition 5.0. The language described in The Java Language Specification, Third Edition . First release to support generics, annotations, autoboxing, var-args, enhanced for loop, and hexadecimal floating-point literals.

    field:RELEASE_6 [NONE]

    RELEASE_6

    public static final  SourceVersion RELEASE_6
    The version recognized by the Java Platform, Standard Edition 6. No major changes from RELEASE_5.

    field:RELEASE_7 [NONE]

    RELEASE_7

    public static final  SourceVersion 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

    field:RELEASE_8 [NONE]

    RELEASE_8

    public static final  SourceVersion 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

    field:RELEASE_9 [NONE]

    RELEASE_9

    public static final  SourceVersion 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

    field:RELEASE_10 [NONE]

    RELEASE_10

    public static final  SourceVersion RELEASE_10
    The version recognized by the Java Platform, Standard Edition 10. Additions in this release include local-variable type inference (var).
    Since:
    10

    field:RELEASE_11 [NONE]

    RELEASE_11

    public static final  SourceVersion RELEASE_11
    The version recognized by the Java Platform, Standard Edition 11. Additions in this release include local-variable syntax for lambda parameters.
    Since:
    11

    field:RELEASE_12 [NONE]

    RELEASE_12

    public static final  SourceVersion RELEASE_12
    The version recognized by the Java Platform, Standard Edition 12.
    Since:
    12

    field:RELEASE_13 [NONE]

    RELEASE_13

    public static final  SourceVersion RELEASE_13
    The version recognized by the Java Platform, Standard Edition 13.
    Since:
    13

    field:RELEASE_14 [NONE]

    RELEASE_14

    public static final  SourceVersion RELEASE_14
    The version recognized by the Java Platform, Standard Edition 14. Additions in this release include switch expressions.
    Since:
    14

    field:RELEASE_15 [ADDED]

    RELEASE_15

    public static final  SourceVersion RELEASE_15
    The version recognized by the Java Platform, Standard Edition 15. Additions in this release include text blocks.
    Since:
    15

    method:values() [NONE]

  • values

    public static  SourceVersion[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
    an array containing the constants of this enum type, in the order they are declared
  • method:valueOf(java.lang.String) [NONE]

    valueOf

    public static  SourceVersion valueOf?(String 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 - if this enum type has no constant with the specified name
    NullPointerException - if the argument is null

    method:latest() [NONE]

    latest

    public static  SourceVersion latest()
    Returns the latest source version that can be modeled.
    Returns:
    the latest source version that can be modeled

    method:latestSupported() [NONE]

    latestSupported

    public static  SourceVersion latestSupported()
    Returns the latest source version fully supported by the current execution environment. RELEASE_9 or later must be returned.
    API Note:
    This method is included alongside latest() to allow identification of situations where the language model API is running on a platform version different than the latest version modeled by the API. One way that sort of situation can occur is if an IDE or similar tool is using the API to model source version N while running on platform version (N - 1). Running in this configuration is supported by the API. Running an API on platform versions earlier than (N - 1) or later than N may or may not work as an implementation detail. If an annotation processor was generating code to run under the current execution environment, the processor should only use platform features up to the latestSupported release, which may be earlier than the latest release.
    Returns:
    the latest source version that is fully supported

    method:isIdentifier(java.lang.CharSequence) [NONE]

    isIdentifier

    public static  boolean isIdentifier?(CharSequence 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) returns true, followed only by characters for which Character.isJavaIdentifierPart(int) returns true. This pattern matches regular identifiers, keywords, restricted keywords, restricted identifiers and the literals "true", "false", "null". 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.

    method:isName(java.lang.CharSequence) [CHANGED]

    isName

    public static  boolean isName?(CharSequence name)
    Returns whether or not name is a syntactically valid qualified name in the latest source version. Syntactically, a qualified name is a sequence of identifiers separated by period characters ("."). This method splits the input string into period-separated segments and applies checks to each segment in turn. Unlike isIdentifier, this method returns false for keywords, boolean literals, and the null literal in any segment. This method returns true for restricted keywords and restricted identifiers .
    Parameters:
    name - the string to check
    Returns:
    true if this string is a syntactically valid name, false otherwise.
    See Java Language Specification :
    3.9 Keywords

    6.2 Names and Identifiers

    isName

    public static  boolean isName?(CharSequence name)
    Returns whether or not name is a syntactically valid qualified name in the latest source version. Unlike isIdentifier, this method returns false for keywords, boolean literals, and the null literal. This method returns true for restricted keywords and restricted identifiers
    Parameters:
    name - the string to check
    Returns:
    true if this string is a syntactically valid name, false otherwise.
    See Java Language Specification :
    3.9 Keywords
    6.2 Names and Identifiers

    isName

    public static  boolean isName?(CharSequence name)
    Returns whether or not name is a syntactically valid qualified name in the latest source version. Syntactically, a qualified name is a sequence of identifiers separated by period characters ("."). This method splits the input string into period-separated segments and applies checks to each segment in turn. Unlike isIdentifier, this method returns false for keywords, boolean literals, and the null literal in any segment. This method returns true for restricted keywords and restricted identifiers .
    Parameters:
    name - the string to check
    Returns:
    true if this string is a syntactically valid name, false otherwise.

    method:isName(java.lang.CharSequence,javax.lang.model.SourceVersion) [CHANGED]

    isName

    public static  boolean isName?(CharSequence name, SourceVersion version)
    Returns whether or not name is a syntactically valid qualified name in the given source version. Syntactically, a qualified name is a sequence of identifiers separated by period characters ("."). This method splits the input string into period-separated segments and applies checks to each segment in turn. Unlike isIdentifier, this method returns false for keywords, boolean literals, and the null literal in any segment. This method returns true for restricted keywords and restricted identifiers .
    Parameters:
    name - the string to check
    version - the version to use
    Returns:
    true if this string is a syntactically valid name, false otherwise.
    See Java Language Specification :
    3.9 Keywords

    6.2 Names and Identifiers

    Since:
    9

    isName

    public static  boolean isName?(CharSequence name, SourceVersion version)
    Returns whether or not name is a syntactically valid qualified name in the given source version. Unlike isIdentifier, this method returns false for keywords, boolean literals, and the null literal. This method returns true for restricted keywords and restricted identifiers
    Parameters:
    name - the string to check
    version - the version to use
    Returns:
    true if this string is a syntactically valid name, false otherwise.
    See Java Language Specification :
    3.9 Keywords
    6.2 Names and Identifiers
    Since:
    9

    isName

    public static  boolean isName?(CharSequence name, SourceVersion version)
    Returns whether or not name is a syntactically valid qualified name in the given source version. Syntactically, a qualified name is a sequence of identifiers separated by period characters ("."). This method splits the input string into period-separated segments and applies checks to each segment in turn. Unlike isIdentifier, this method returns false for keywords, boolean literals, and the null literal in any segment. This method returns true for restricted keywords and restricted identifiers .
    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

    method:isKeyword(java.lang.CharSequence) [CHANGED]

    isKeyword

    public static  boolean isKeyword?(CharSequence 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 restricted identifiers .
    Parameters:
    s - the string to check
    Returns:
    true if s is a keyword, or boolean literal, or null literal, false otherwise.
    See Java Language Specification :
    3.9 Keywords

    3.10.3 Boolean Literals

    3.10.7 The Null Literal

    isKeyword

    public static  boolean isKeyword?(CharSequence 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 restricted identifiers .
    Parameters:
    s - the string to check
    Returns:
    true if s is a keyword, or boolean literal, or null literal, false otherwise.
    See Java Language Specification :
    3.9 Keywords
    3.10.3 Boolean Literals
    3.10.7 The Null Literal

    isKeyword

    public static  boolean isKeyword?(CharSequence 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 restricted identifiers .
    Parameters:
    s - the string to check
    Returns:
    true if s is a keyword, or boolean literal, or null literal, false otherwise.

    method:isKeyword(java.lang.CharSequence,javax.lang.model.SourceVersion) [CHANGED]

    isKeyword

    public static  boolean isKeyword?(CharSequence s, SourceVersion 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 restricted identifiers .
    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.
    See Java Language Specification :
    3.9 Keywords

    3.10.3 Boolean Literals

    3.10.7 The Null Literal

    Since:
    9

    isKeyword

    public static  boolean isKeyword?(CharSequence s, SourceVersion 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 restricted identifiers .
    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.
    See Java Language Specification :
    3.9 Keywords
    3.10.3 Boolean Literals
    3.10.7 The Null Literal
    Since:
    9

    isKeyword

    public static  boolean isKeyword?(CharSequence s, SourceVersion 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 restricted identifiers .
    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

    © 2020 Oracle Corporation and/or its affiliates