21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291 |
26 * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291 8196551 |
27 * @summary Test latest, latestSupported, underscore as keyword, etc. |
27 * @summary Test latest, latestSupported, underscore as keyword, etc. |
28 * @author Joseph D. Darcy |
28 * @author Joseph D. Darcy |
29 * @modules java.compiler |
29 * @modules java.compiler |
30 * jdk.compiler |
30 * jdk.compiler |
31 */ |
31 */ |
44 testRestrictedKeywords(); |
44 testRestrictedKeywords(); |
45 testVar(); |
45 testVar(); |
46 } |
46 } |
47 |
47 |
48 private static void testLatestSupported() { |
48 private static void testLatestSupported() { |
49 if (SourceVersion.latest() != RELEASE_11 || |
49 SourceVersion[] values = SourceVersion.values(); |
50 SourceVersion.latestSupported() != RELEASE_10) |
50 SourceVersion last = values[values.length - 1]; |
|
51 SourceVersion latest = SourceVersion.latest(); |
|
52 SourceVersion latestSupported = SourceVersion.latestSupported(); |
|
53 |
|
54 if (latest == last && |
|
55 latestSupported == SourceVersion.valueOf("RELEASE_" + Runtime.version().feature()) && |
|
56 (latest == latestSupported || (latest.ordinal() - latestSupported.ordinal() == 1)) ) |
|
57 return; |
|
58 else { |
51 throw new RuntimeException("Unexpected release value(s) found:\n" + |
59 throw new RuntimeException("Unexpected release value(s) found:\n" + |
52 "latest:\t" + SourceVersion.latest() + "\n" + |
60 "latest:\t" + latest + "\n" + |
53 "latestSupported:\t" + SourceVersion.latestSupported()); |
61 "latestSupported:\t" + latestSupported); |
|
62 } |
54 } |
63 } |
55 |
64 |
56 private static void testVersionVaryingKeywords() { |
65 private static void testVersionVaryingKeywords() { |
57 Map<String, SourceVersion> keyWordStart = |
66 Map<String, SourceVersion> keyWordStart = |
58 Map.of("strictfp", RELEASE_2, |
67 Map.of("strictfp", RELEASE_2, |