src/share/classes/javax/lang/model/SourceVersion.java
Print this page
*** 53,62 ****
--- 53,63 ----
* 1.4: assert
* 1.5: annotations, generics, autoboxing, var-args...
* 1.6: no changes
* 1.7: diamond syntax, try-with-resources, etc.
* 1.8: lambda expressions and default methods
+ * 1.9: To be determined
*/
/**
* The original version.
*
*** 136,171 ****
* 8.
*
* Additions in this release include lambda expressions and default methods.
* @since 1.8
*/
! RELEASE_8;
// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
/**
* Returns the latest source version that can be modeled.
*
* @return the latest source version that can be modeled
*/
public static SourceVersion latest() {
! return RELEASE_8;
}
private static final SourceVersion latestSupported = getLatestSupported();
private static SourceVersion getLatestSupported() {
try {
! String specVersion = System.getProperty("java.specification.version");
!
! if ("1.8".equals(specVersion))
return RELEASE_8;
! else if("1.7".equals(specVersion))
return RELEASE_7;
! else if("1.6".equals(specVersion))
return RELEASE_6;
} catch (SecurityException se) {}
return RELEASE_5;
}
--- 137,182 ----
* 8.
*
* Additions in this release include lambda expressions and default methods.
* @since 1.8
*/
! RELEASE_8,
!
! /**
! * The version recognized by the Java Platform, Standard Edition
! * 9.
! *
! * @since 1.9
! */
! RELEASE_9;
// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
/**
* Returns the latest source version that can be modeled.
*
* @return the latest source version that can be modeled
*/
public static SourceVersion latest() {
! return RELEASE_9;
}
private static final SourceVersion latestSupported = getLatestSupported();
private static SourceVersion getLatestSupported() {
try {
! switch (System.getProperty("java.specification.version")) {
! case "1.9":
! return RELEASE_9;
! case "1.8":
return RELEASE_8;
! case "1.7":
return RELEASE_7;
! case "1.6":
return RELEASE_6;
+ }
} catch (SecurityException se) {}
return RELEASE_5;
}
*** 267,275 ****
*
* @param s the string to check
* @return {@code true} if {@code s} is a keyword or literal, {@code false} otherwise.
*/
public static boolean isKeyword(CharSequence s) {
! String keywordOrLiteral = s.toString();
! return keywords.contains(keywordOrLiteral);
}
}
--- 278,285 ----
*
* @param s the string to check
* @return {@code true} if {@code s} is a keyword or literal, {@code false} otherwise.
*/
public static boolean isKeyword(CharSequence s) {
! return keywords.contains(s.toString());
}
}