8028543: Add SourceVersion.RELEASE_9
authordarcy
Tue, 07 Jan 2014 11:43:56 -0800
changeset 22169 4be6dc44489b
parent 22168 a48fe7ec473d
child 22170 62da5257a0a7
8028543: Add SourceVersion.RELEASE_9 Reviewed-by: jjg
langtools/src/share/classes/javax/lang/model/SourceVersion.java
langtools/test/tools/javac/api/T6395981.java
langtools/test/tools/javac/processing/model/TestSourceVersion.java
--- a/langtools/src/share/classes/javax/lang/model/SourceVersion.java	Sun Dec 22 21:57:01 2013 -0800
+++ b/langtools/src/share/classes/javax/lang/model/SourceVersion.java	Tue Jan 07 11:43:56 2014 -0800
@@ -55,6 +55,7 @@
      * 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 @@
      * 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 @@
      * @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 @@
             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 @@
      * @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());
     }
 }
--- a/langtools/test/tools/javac/api/T6395981.java	Sun Dec 22 21:57:01 2013 -0800
+++ b/langtools/test/tools/javac/api/T6395981.java	Tue Jan 07 11:43:56 2014 -0800
@@ -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;
--- a/langtools/test/tools/javac/processing/model/TestSourceVersion.java	Sun Dec 22 21:57:01 2013 -0800
+++ b/langtools/test/tools/javac/processing/model/TestSourceVersion.java	Tue Jan 07 11:43:56 2014 -0800
@@ -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 @@
  */
 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());