--- old/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java 2019-10-29 09:54:14.072453999 -0700 +++ new/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java 2019-10-29 09:54:13.840338000 -0700 @@ -58,9 +58,9 @@ * 9: modules, small cleanups to 1.7 and 1.8 changes * 10: local-variable type inference (var) * 11: local-variable syntax for lambda parameters - * 12: no changes (switch expressions were in preview) + * 12: no changes (switch expressions in preview) * 13: no changes (switch expressions and text blocks in preview) - * 14: TBD + * 14: switch expressions */ /** @@ -199,6 +199,8 @@ * The version recognized by the Java Platform, Standard Edition * 14. * + * Additions in this release include switch expressions. + * * @since 14 */ RELEASE_14; --- old/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java 2019-10-29 09:54:14.684759999 -0700 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java 2019-10-29 09:54:14.432634000 -0700 @@ -84,7 +84,7 @@ /** 1.11 local-variable syntax for lambda parameters */ JDK11("11"), - /** 12, no language features; switch expression were in preview */ + /** 12, no language features; switch expression in preview */ JDK12("12"), /** @@ -94,8 +94,7 @@ JDK13("13"), /** - * 14 covers the to be determined language features that will be - * added in JDK 14. + * 14, switch expressions */ JDK14("14"); --- old/test/langtools/tools/javac/processing/model/TestSourceVersion.java 2019-10-29 09:54:15.277056000 -0700 +++ new/test/langtools/tools/javac/processing/model/TestSourceVersion.java 2019-10-29 09:54:15.040937999 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 8028543 6415644 8028544 8029942 8187951 8193291 8196551 + * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291 8196551 8233096 * @summary Test latest, latestSupported, underscore as keyword, etc. * @author Joseph D. Darcy * @modules java.compiler @@ -35,7 +35,7 @@ import static javax.lang.model.SourceVersion.*; /** - * Verify latest[Supported] behavior. + * Verify latest[Supported] behavior and other methods. */ public class TestSourceVersion { public static void main(String... args) { @@ -43,6 +43,7 @@ testVersionVaryingKeywords(); testRestrictedKeywords(); testVar(); + testYield(); } private static void testLatestSupported() { @@ -107,7 +108,6 @@ } private static void testVar() { - for(SourceVersion version : SourceVersion.values()) { check(false, isKeyword("var", version), "keyword", version); check(false, isKeyword("foo.var", version), "keyword", version); @@ -119,6 +119,18 @@ } } + private static void testYield() { + for(SourceVersion version : SourceVersion.values()) { + check(false, isKeyword("yield", version), "keyword", version); + check(false, isKeyword("foo.yield", version), "keyword", version); + check(false, isKeyword("yield.foo", version), "keyword", version); + + check(true, isName("yield", version), "name", version); + check(true, isName("foo.yield", version), "name", version); + check(true, isName("yield.foo", version), "name", version); + } + } + private static void check(boolean result, boolean expected, String message, SourceVersion version) { if (result != expected) {