test/langtools/tools/javac/processing/model/TestSourceVersion.java
changeset 48694 b0a54e2ba484
parent 48538 82c3d4173a53
child 59068 dc45ed0ab083
--- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java	Thu Feb 01 09:07:25 2018 -0800
+++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java	Thu Feb 01 09:16:03 2018 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291
+ * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291 8196551
  * @summary Test latest, latestSupported, underscore as keyword, etc.
  * @author  Joseph D. Darcy
  * @modules java.compiler
@@ -46,11 +46,20 @@
     }
 
     private static void testLatestSupported() {
-        if (SourceVersion.latest() != RELEASE_11 ||
-            SourceVersion.latestSupported() != RELEASE_10)
+        SourceVersion[] values = SourceVersion.values();
+        SourceVersion last = values[values.length - 1];
+        SourceVersion latest = SourceVersion.latest();
+        SourceVersion latestSupported = SourceVersion.latestSupported();
+
+        if (latest == last &&
+            latestSupported == SourceVersion.valueOf("RELEASE_" + Runtime.version().feature()) &&
+            (latest == latestSupported || (latest.ordinal() - latestSupported.ordinal() == 1)) )
+            return;
+        else {
             throw new RuntimeException("Unexpected release value(s) found:\n" +
-                                       "latest:\t" + SourceVersion.latest() + "\n" +
-                                       "latestSupported:\t" + SourceVersion.latestSupported());
+                                       "latest:\t" + latest + "\n" +
+                                       "latestSupported:\t" + latestSupported);
+        }
     }
 
     private static void testVersionVaryingKeywords() {