8028543: Add SourceVersion.RELEASE_9
Reviewed-by: jjg
This commit is contained in:
parent
8d4ba575b6
commit
6fc7157058
@ -55,6 +55,7 @@ public enum SourceVersion {
|
||||
* 1.6: no changes
|
||||
* 1.7: diamond syntax, try-with-resources, etc.
|
||||
* 1.8: lambda expressions and default methods
|
||||
* 1.9: To be determined
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -138,7 +139,15 @@ public enum SourceVersion {
|
||||
* Additions in this release include lambda expressions and default methods.
|
||||
* @since 1.8
|
||||
*/
|
||||
RELEASE_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.
|
||||
@ -149,7 +158,7 @@ public enum SourceVersion {
|
||||
* @return the latest source version that can be modeled
|
||||
*/
|
||||
public static SourceVersion latest() {
|
||||
return RELEASE_8;
|
||||
return RELEASE_9;
|
||||
}
|
||||
|
||||
private static final SourceVersion latestSupported = getLatestSupported();
|
||||
@ -159,6 +168,8 @@ public enum SourceVersion {
|
||||
String specVersion = System.getProperty("java.specification.version");
|
||||
|
||||
switch (specVersion) {
|
||||
case "1.9":
|
||||
return RELEASE_9;
|
||||
case "1.8":
|
||||
return RELEASE_8;
|
||||
case "1.7":
|
||||
@ -271,7 +282,6 @@ public enum SourceVersion {
|
||||
* @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);
|
||||
return keywords.contains(s.toString());
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6395981 6458819 7025784
|
||||
* @bug 6395981 6458819 7025784 8028543
|
||||
* @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @run main/fail T6395981
|
||||
* @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
|
||||
* @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
|
||||
* @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8
|
||||
* @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9
|
||||
*/
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 7025809
|
||||
* @bug 7025809 8028543
|
||||
* @summary Test latest and latestSupported
|
||||
* @author Joseph D. Darcy
|
||||
*/
|
||||
@ -36,8 +36,8 @@ import static javax.lang.model.SourceVersion.*;
|
||||
*/
|
||||
public class TestSourceVersion {
|
||||
public static void main(String... args) {
|
||||
if (SourceVersion.latest() != RELEASE_8 ||
|
||||
SourceVersion.latestSupported() != RELEASE_8)
|
||||
if (SourceVersion.latest() != RELEASE_9 ||
|
||||
SourceVersion.latestSupported() != RELEASE_9)
|
||||
throw new RuntimeException("Unexpected release value(s) found:\n" +
|
||||
"latest:\t" + SourceVersion.latest() + "\n" +
|
||||
"latestSupported:\t" + SourceVersion.latestSupported());
|
||||
|
Loading…
Reference in New Issue
Block a user