8219254: Update explicit uses of latest source/target in langtools tests to a property
authordarcy
Thu, 21 Feb 2019 10:29:16 -0800
changeset 53878 4584d0331318
parent 53877 dfea18758dfa
child 53879 e7cb0348fa1c
8219254: Update explicit uses of latest source/target in langtools tests to a property 8219256: Update javac diags tests to use properties Reviewed-by: jjg, jlahoda, darcy, iignatyev Contributed-by: joe.darcy@oracle.com, jonathan.gibbons@oracle.com
test/langtools/TEST.ROOT
test/langtools/tools/javac/6330997/T6330997.java
test/langtools/tools/javac/ConditionalWithVoid.java
test/langtools/tools/javac/diags/Example.java
test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java
test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java
test/langtools/tools/javac/diags/examples/BreakMissingValue.java
test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java
test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java
test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java
test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java
test/langtools/tools/javac/diags/examples/NotExhaustive.java
test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java
test/langtools/tools/javac/diags/examples/PreviewFilename.java
test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java
test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java
test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java
test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java
test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java
test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java
test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java
test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java
test/langtools/tools/javac/diags/examples/SwitchExpressions.java
test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java
test/langtools/tools/javac/diags/examples/SwitchRules.java
test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java
test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java
test/langtools/tools/javac/parser/JavacParserTest.java
test/langtools/tools/javac/preview/classReaderTest/Client.java
test/langtools/tools/javac/switchexpr/BlockExpression.java
test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java
test/langtools/tools/javac/switchexpr/BreakTest.java
test/langtools/tools/javac/switchexpr/CRT.java
test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java
test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java
test/langtools/tools/javac/switchexpr/EmptySwitch.java
test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java
test/langtools/tools/javac/switchexpr/ExpressionSwitch.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java
test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java
test/langtools/tools/javac/switchexpr/ParseIncomplete.java
test/langtools/tools/javac/switchexpr/ParserRecovery.java
test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java
test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java
test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java
test/langtools/tools/javac/switchexpr/TryCatch.java
test/langtools/tools/javac/switchextra/CaseTest.java
test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java
test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java
test/langtools/tools/javac/switchextra/RuleParsingTest.java
test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java
test/langtools/tools/javac/switchextra/SwitchStatementArrow.java
test/langtools/tools/javac/switchextra/SwitchStatementBroken.java
test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java
test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java
--- a/test/langtools/TEST.ROOT	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/TEST.ROOT	Thu Feb 21 10:29:16 2019 -0800
@@ -15,7 +15,7 @@
 groups=TEST.groups
 
 # Minimum jtreg version
-requiredVersion=4.2 b13
+requiredVersion=4.2 b14
 
 # Use new module options
 useNewOptions=true
--- a/test/langtools/tools/javac/6330997/T6330997.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/6330997/T6330997.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -32,8 +32,8 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  * @clean T1 T2
- * @compile -source 12 -target 13 T1.java
- * @compile -source 12 -target 13 T2.java
+ * @compile T1.java
+ * @compile T2.java
  * @run main/othervm T6330997
  */
 
--- a/test/langtools/tools/javac/ConditionalWithVoid.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/ConditionalWithVoid.java	Thu Feb 21 10:29:16 2019 -0800
@@ -4,7 +4,7 @@
  * @summary The compiler was allowing void types in its parsing of conditional expressions.
  * @author tball
  *
- * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source 13 -XDrawDiagnostics ConditionalWithVoid.java
+ * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ConditionalWithVoid.java
  */
 public class ConditionalWithVoid {
     public void test(Object o, String s) {
--- a/test/langtools/tools/javac/diags/Example.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/Example.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -288,7 +288,7 @@
         opts.add("-d");
         opts.add(classesDir.getPath());
         if (options != null)
-            opts.addAll(options);
+            opts.addAll(evalProperties(options));
 
         if (procFiles.size() > 0) {
             List<String> pOpts = new ArrayList<>(Arrays.asList("-d", classesDir.getPath()));
@@ -355,6 +355,51 @@
         }
     }
 
+    private static List<String> evalProperties(List<String> args) {
+        boolean fast = true;
+        for (String arg : args) {
+            fast = fast && (arg.indexOf("${") == -1);
+        }
+        if (fast) {
+            return args;
+        }
+        List<String> newArgs = new ArrayList<>();
+        for (String arg : args) {
+            newArgs.add(evalProperties(arg));
+        }
+        return newArgs;
+    }
+
+    private static final Pattern namePattern = Pattern.compile("\\$\\{([A-Za-z0-9._]+)\\}");
+    private static final String jdkVersion = Integer.toString(Runtime.version().feature());
+
+    private static String evalProperties(String arg) {
+        Matcher m = namePattern.matcher(arg);
+        StringBuilder sb = null;
+        while (m.find()) {
+            if (sb == null) {
+                sb = new StringBuilder();
+            }
+            String propName = m.group(1);
+            String propValue;
+            switch (propName) {
+                case "jdk.version":
+                    propValue = jdkVersion;
+                    break;
+                default:
+                    propValue = System.getProperty(propName);
+                    break;
+            }
+            m.appendReplacement(sb, propValue != null ? propValue : m.group(0).replace("$", "\\$"));
+        }
+        if (sb == null) {
+            return arg;
+        } else {
+            m.appendTail(sb);
+            return sb.toString();
+        }
+    }
+
     void createAnnotationServicesFile(File dir, List<File> procFiles) throws IOException {
         File servicesDir = new File(new File(dir, "META-INF"), "services");
         servicesDir.mkdirs();
--- a/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.break.ambiguous.target
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class BreakAmbiguousTarget {
     void m(int i, int j) {
--- a/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -33,7 +33,7 @@
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
 // key: compiler.note.note
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 // run: backdoor
 
 class BreakExprNotImmediate {
--- a/test/langtools/tools/javac/diags/examples/BreakMissingValue.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/BreakMissingValue.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.break.missing.value
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class BreakMissingValue {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.break.outside.switch.expression
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class BreakOutsideSwitchExpression {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.continue.outside.switch.expression
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class ContinueOutsideSwitchExpression {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -26,7 +26,7 @@
 // key: compiler.misc.inconvertible.types
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 
 class IncompatibleTypesInSwitchExpression {
--- a/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
 
 // key: compiler.misc.feature.multiple.case.labels
 // key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 13 -Xlint:preview
+// options: --enable-preview -source ${jdk.version} -Xlint:preview
 
 class MultipleCaseLabels {
     void m(int i) {
--- a/test/langtools/tools/javac/diags/examples/NotExhaustive.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/NotExhaustive.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.not.exhaustive
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class NotExhaustive {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
 //key: compiler.warn.preview.feature.use.plural
 //key: compiler.misc.feature.diamond
 //key: compiler.misc.feature.lambda
-//options: -Xlint:preview -XDforcePreview -source 13 --enable-preview
+//options: -Xlint:preview -XDforcePreview -source ${jdk.version} --enable-preview
 
 import java.util.ArrayList;
 
--- a/test/langtools/tools/javac/diags/examples/PreviewFilename.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/PreviewFilename.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
 
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: -XDforcePreview  -source 13 --enable-preview
+// options: -XDforcePreview  -source ${jdk.version} --enable-preview
 
 import java.util.ArrayList;
 import java.util.List;
--- a/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.note.preview.filename.additional
 // key: compiler.warn.preview.feature.use
 // key: compiler.misc.feature.diamond
-// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview  -source 13 --enable-preview
+// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview  -source ${jdk.version} --enable-preview
 
 import java.util.ArrayList;
 
--- a/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
 
 // key: compiler.note.preview.plural
 // key: compiler.note.preview.recompile
-// options: -XDforcePreview  -source 13 --enable-preview
+// options: -XDforcePreview  -source ${jdk.version} --enable-preview
 
 import java.util.ArrayList;
 
--- a/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.return.outside.switch.expression
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class ReturnOutsideSwitchExpression {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.rule.completes.normally
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class RuleCompletesNormally {
     public String convert(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.switch.case.unexpected.statement
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class ReturnOutsideSwitchExpression {
     void t(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.switch.expression.completes.normally
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class SwitchExpressionCompletesNormally {
     public String convert(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.switch.expression.empty
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class BreakOutsideSwitchExpression {
     String t(E e) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -26,7 +26,7 @@
 // key: compiler.misc.switch.expression.target.cant.be.void
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class SwitchExpressionTargetCantBeVoid {
 
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressions.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressions.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
 
 // key: compiler.misc.feature.switch.expressions
 // key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 13 -Xlint:preview
+// options: --enable-preview -source ${jdk.version} -Xlint:preview
 
 class SwitchExpressions {
     int m(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -24,7 +24,7 @@
 // key: compiler.err.switch.mixing.case.types
 // key: compiler.note.preview.filename
 // key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
 
 class SwitchMixingCaseTypes {
 
--- a/test/langtools/tools/javac/diags/examples/SwitchRules.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/diags/examples/SwitchRules.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
 
 // key: compiler.misc.feature.switch.rules
 // key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 13 -Xlint:preview
+// options: --enable-preview -source ${jdk.version} -Xlint:preview
 
 class SwitchExpressions {
     void m(int i) {
--- a/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -75,7 +75,8 @@
         }
     }
 
-    private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", "13"};
+    private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source",
+                                               Integer.toString(Runtime.version().feature())};
 
     private void program(String... constructs) {
         String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }";
--- a/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Adding switch expressions
- * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source 13 BadSwitchExpressionLambda.java
+ * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BadSwitchExpressionLambda.java
  */
 
 class BadSwitchExpressionLambda {
--- a/test/langtools/tools/javac/parser/JavacParserTest.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/parser/JavacParserTest.java	Thu Feb 21 10:29:16 2019 -0800
@@ -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
@@ -88,14 +88,14 @@
 public class JavacParserTest extends TestCase {
     static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
     static final JavaFileManager fm = tool.getStandardFileManager(null, null, null);
+    public static final String SOURCE_VERSION =
+        Integer.toString(Runtime.version().feature());
 
     private JavacParserTest(){}
 
     public static void main(String... args) throws Exception {
-        try {
+        try (fm) {
             new JavacParserTest().run(args);
-        } finally {
-            fm.close();
         }
     }
 
@@ -1096,7 +1096,7 @@
         String expectedErrors = "Test.java:1:178: compiler.err.switch.case.unexpected.statement\n";
         StringWriter out = new StringWriter();
         JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
-                Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", "13"),
+                Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", SOURCE_VERSION),
                 null, Arrays.asList(new MyFileObject(code)));
 
         CompilationUnitTree cut = ct.parse().iterator().next();
--- a/test/langtools/tools/javac/preview/classReaderTest/Client.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/preview/classReaderTest/Client.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,9 +2,9 @@
  * @test /nodynamiccopyright/
  * @bug 8199194
  * @summary smoke test for --enabled-preview classreader support
- * @compile -XDforcePreview --enable-preview -source 13 Bar.java
+ * @compile -XDforcePreview --enable-preview -source ${jdk.version} Bar.java
  * @compile/fail/ref=Client.nopreview.out -Xlint:preview -XDrawDiagnostics Client.java
- * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source 13 Client.java
+ * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source ${jdk.version} Client.java
  */
 
 public class Client {
--- a/test/langtools/tools/javac/switchexpr/BlockExpression.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/BlockExpression.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Verify rule cases with expression statements and throw statements work.
- * @compile --enable-preview -source 13 BlockExpression.java
+ * @compile --enable-preview -source ${jdk.version} BlockExpression.java
  * @run main/othervm --enable-preview BlockExpression
  */
 
--- a/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify the type of a conditional expression with nested switch expression is computed properly
- * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source 13 BooleanNumericNonNumeric.java
+ * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BooleanNumericNonNumeric.java
  */
 
 public class BooleanNumericNonNumeric {
--- a/test/langtools/tools/javac/switchexpr/BreakTest.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/BreakTest.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -61,12 +61,13 @@
 
     public static void main(String[] args) throws Exception {
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        String sourceVersion = Integer.toString(Runtime.version().feature());
         assert tool != null;
         DiagnosticListener<JavaFileObject> noErrors = d -> {};
 
         StringWriter out = new StringWriter();
         JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
-            List.of("-XDdev", "--enable-preview", "-source", "13"), null,
+            List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null,
             Arrays.asList(new MyFileObject(CODE)));
         List<String> labels = new ArrayList<>();
         new TreePathScanner<Void, Void>() {
--- a/test/langtools/tools/javac/switchexpr/CRT.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/CRT.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -48,6 +48,8 @@
         new CRT().run();
     }
 
+    private static final String SOURCE_VERSION = Integer.toString(Runtime.version().feature());
+
     private ToolBox tb = new ToolBox();
 
     private void run() throws Exception {
@@ -151,7 +153,7 @@
         new JavacTask(tb)
                 .options("-Xjcov",
                          "--enable-preview",
-                         "-source", "13")
+                         "-source", SOURCE_VERSION)
                 .outdir(classes)
                 .sources("public class Test {\n" +
                          code +
--- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8214031
  * @summary Verify that definite assignment when true works (legal code)
- * @compile --enable-preview --source 13 DefiniteAssignment1.java
+ * @compile --enable-preview --source ${jdk.version} DefiniteAssignment1.java
  * @run main/othervm --enable-preview DefiniteAssignment1
  */
 public class DefiniteAssignment1 {
--- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8214031
  * @summary Verify that definite assignment when true works (illegal code)
- * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source 13 -XDrawDiagnostics DefiniteAssignment2.java
+ * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source ${jdk.version} -XDrawDiagnostics DefiniteAssignment2.java
  */
 public class DefiniteAssignment2 {
 
--- a/test/langtools/tools/javac/switchexpr/EmptySwitch.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/EmptySwitch.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Verify than an empty switch expression is rejected.
- * @compile/fail/ref=EmptySwitch.out --enable-preview -source 13 -XDrawDiagnostics EmptySwitch.java
+ * @compile/fail/ref=EmptySwitch.out --enable-preview -source ${jdk.version} -XDrawDiagnostics EmptySwitch.java
  */
 
 public class EmptySwitch {
--- a/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Verify that an switch expression over enum can be exhaustive without default.
- * @compile --enable-preview -source 13 ExhaustiveEnumSwitch.java
+ * @compile --enable-preview -source ${jdk.version} ExhaustiveEnumSwitch.java
  * @compile ExhaustiveEnumSwitchExtra.java
  * @run main/othervm --enable-preview ExhaustiveEnumSwitch
  */
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java	Thu Feb 21 10:29:16 2019 -0800
@@ -3,7 +3,7 @@
  * @bug 8206986
  * @summary Check expression switch works.
  * @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java
- * @compile --enable-preview -source 13 ExpressionSwitch.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitch.java
  * @run main/othervm --enable-preview ExpressionSwitch
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Verify behavior of various kinds of breaks.
- * @compile --enable-preview -source 13 ExpressionSwitchBreaks1.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBreaks1.java
  * @run main/othervm --enable-preview ExpressionSwitchBreaks1
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Check behavior for invalid breaks.
- * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchBreaks2.java
+ * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchBreaks2.java
  */
 
 public class ExpressionSwitchBreaks2 {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986 8214114 8214529
  * @summary Verify various corner cases with nested switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchBugs.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugs.java
  * @run main/othervm --enable-preview ExpressionSwitchBugs
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8214031
  * @summary Verify various corner cases with nested switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchBugsInGen.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugsInGen.java
  * @run main/othervm --enable-preview ExpressionSwitchBugsInGen
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Check switch expressions
- * @compile --enable-preview -source 13 ExpressionSwitchCodeFromJLS.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchCodeFromJLS.java
  * @run main/othervm --enable-preview ExpressionSwitchCodeFromJLS
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Check definite (un)assignment for in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchDA.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchDA.java
  * @run main/othervm --enable-preview ExpressionSwitchDA
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8214031 8214114
  * @summary Verify switch expressions embedded in various statements work properly.
- * @compile --enable-preview -source 13 ExpressionSwitchEmbedding.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchEmbedding.java
  * @run main/othervm --enable-preview ExpressionSwitchEmbedding
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Check fall through in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchFallThrough.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough.java
  * @run main/othervm --enable-preview ExpressionSwitchFallThrough
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Check fall through in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchFallThrough1.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough1.java
  * @run main/othervm --enable-preview ExpressionSwitchFallThrough1
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8212982
  * @summary Verify a compile-time error is produced if switch expression does not provide a value
- * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source 13 -XDrawDiagnostics ExpressionSwitchFlow.java
+ * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ExpressionSwitchFlow.java
  */
 
 public class ExpressionSwitchFlow {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java	Thu Feb 21 10:29:16 2019 -0800
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Check switch expressions embedded in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchInExpressionSwitch.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchInExpressionSwitch.java
  * @run main/othervm --enable-preview ExpressionSwitchInExpressionSwitch
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Check types inferred for switch expressions.
- * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchInfer.java
+ * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchInfer.java
  */
 
 import java.util.ArrayList;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8206986
  * @summary Verify behavior when an intersection type is inferred for switch expression.
- * @compile --enable-preview -source 13 ExpressionSwitchIntersectionTypes.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchIntersectionTypes.java
  * @run main/othervm --enable-preview ExpressionSwitchIntersectionTypes
  */
 
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify behavior of not exhaustive switch expressions.
- * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchNotExhaustive.java
+ * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchNotExhaustive.java
  */
 
 public class ExpressionSwitchNotExhaustive {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify reachability in switch expressions.
- * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchUnreachable.java
+ * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchUnreachable.java
  */
 
 public class ExpressionSwitchUnreachable {
--- a/test/langtools/tools/javac/switchexpr/ParseIncomplete.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ParseIncomplete.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -61,13 +61,14 @@
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         assert tool != null;
         DiagnosticListener<JavaFileObject> noErrors = d -> {};
+        String sourceVersion = Integer.toString(Runtime.version().feature());
 
         for (int i = 0; i < CODE.length(); i++) {
             String code = CODE.substring(0, i + 1);
             StringWriter out = new StringWriter();
             try {
                 JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
-                    List.of("-XDdev", "--enable-preview", "-source", "13"), null,
+                    List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null,
                     Arrays.asList(new MyFileObject(code)));
                 ct.parse().iterator().next();
             } catch (Throwable t) {
--- a/test/langtools/tools/javac/switchexpr/ParserRecovery.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/ParserRecovery.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify the parser handles broken input gracefully.
- * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source 13 ParserRecovery.java
+ * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ParserRecovery.java
  */
 
 public class ParserRecovery {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -26,7 +26,7 @@
  * @bug 8214113
  * @summary Verify the switch expression's type does not have a constant attached,
  *          and so the switch expression is not elided.
- * @compile --enable-preview --source 13 SwitchExpressionIsNotAConstant.java
+ * @compile --enable-preview --source ${jdk.version} SwitchExpressionIsNotAConstant.java
  * @run main/othervm --enable-preview SwitchExpressionIsNotAConstant
  */
 public class SwitchExpressionIsNotAConstant {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify that scopes in rule cases are isolated.
- * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchExpressionScopesIsolated.java
+ * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchExpressionScopesIsolated.java
  */
 
 public class SwitchExpressionScopesIsolated {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -89,7 +89,7 @@
 
         StringWriter out = new StringWriter();
         JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
-            List.of("--enable-preview", "-source", "13"), null,
+            List.of("--enable-preview", "-source", Integer.toString(Runtime.version().feature())), null,
             Arrays.asList(new MyFileObject(code)));
         return ct.parse().iterator().next();
     }
--- a/test/langtools/tools/javac/switchexpr/TryCatch.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchexpr/TryCatch.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8214114
  * @summary Verify try-catch inside a switch expression works properly.
- * @compile --enable-preview -source 13 TryCatch.java
+ * @compile --enable-preview -source ${jdk.version} TryCatch.java
  * @run main/othervm --enable-preview TryCatch
  */
 public class TryCatch {
--- a/test/langtools/tools/javac/switchextra/CaseTest.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/CaseTest.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -47,12 +47,13 @@
 public class CaseTest {
 
     public static void main(String[] args) throws Exception {
-        new CaseTest().testLabels();
-        new CaseTest().testStatement();
-        new CaseTest().testRule();
+        String sourceVersion = Integer.toString(Runtime.version().feature());
+        new CaseTest().testLabels(sourceVersion);
+        new CaseTest().testStatement(sourceVersion);
+        new CaseTest().testRule(sourceVersion);
     }
 
-    void testLabels() throws Exception {
+    void testLabels(String sourceVersion) throws Exception {
         String code = "class Test {\n" +
                       "    void t(int i) {\n" +
                       "         switch(i) {\n" +
@@ -72,7 +73,7 @@
                                                 .collect(Collectors.joining(",", "[", "]")));
                 return super.visitCase(node, p);
             }
-        }.scan(parse(code), null);
+        }.scan(parse(code, sourceVersion), null);
 
         List<String> expected = Arrays.asList("0", "[0]", "1", "[1,2]", "null", "[]");
 
@@ -81,7 +82,7 @@
         }
     }
 
-    void testStatement() throws Exception {
+    void testStatement(String sourceVersion) throws Exception {
         String code = "class Test {\n" +
                       "    void t(int i) {\n" +
                       "         switch(i) {\n" +
@@ -102,10 +103,10 @@
                 }
                 return super.visitCase(node, p);
             }
-        }.scan(parse(code), null);
+        }.scan(parse(code, sourceVersion), null);
     }
 
-    void testRule() throws Exception {
+    void testRule(String sourceVersion) throws Exception {
         String code = "class Test {\n" +
                       "    void t(int i) {\n" +
                       "         switch(i) {\n" +
@@ -126,17 +127,17 @@
                 }
                 return super.visitCase(node, p);
             }
-        }.scan(parse(code), null);
+        }.scan(parse(code, sourceVersion), null);
     }
 
-    private CompilationUnitTree parse(String code) throws IOException {
+    private CompilationUnitTree parse(String code, String sourceVersion) throws IOException {
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         assert tool != null;
         DiagnosticListener<JavaFileObject> noErrors = d -> {};
 
         StringWriter out = new StringWriter();
         JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
-            List.of("-XDdev", "--enable-preview", "-source", "13"), null,
+            List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null,
             Arrays.asList(new MyFileObject(code)));
         return ct.parse().iterator().next();
     }
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java	Thu Feb 21 10:29:16 2019 -0800
@@ -3,7 +3,7 @@
  * @bug 8206986
  * @summary Verify cases with multiple labels work properly.
  * @compile/fail/ref=MultipleLabelsExpression-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsExpression.java
- * @compile --enable-preview -source 13 MultipleLabelsExpression.java
+ * @compile --enable-preview -source ${jdk.version} MultipleLabelsExpression.java
  * @run main/othervm --enable-preview MultipleLabelsExpression
  */
 
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java	Thu Feb 21 10:29:16 2019 -0800
@@ -3,7 +3,7 @@
  * @bug 8206986
  * @summary Verify cases with multiple labels work properly.
  * @compile/fail/ref=MultipleLabelsStatement-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsStatement.java
- * @compile --enable-preview -source 13 MultipleLabelsStatement.java
+ * @compile --enable-preview -source ${jdk.version} MultipleLabelsStatement.java
  * @run main/othervm --enable-preview MultipleLabelsStatement
  */
 
--- a/test/langtools/tools/javac/switchextra/RuleParsingTest.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/RuleParsingTest.java	Thu Feb 21 10:29:16 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -48,10 +48,11 @@
 public class RuleParsingTest {
 
     public static void main(String[] args) throws Exception {
-        new RuleParsingTest().testParseComplexExpressions();
+        String sourceVersion = Integer.toString(Runtime.version().feature());
+        new RuleParsingTest().testParseComplexExpressions(sourceVersion);
     }
 
-    void testParseComplexExpressions() throws Exception {
+    void testParseComplexExpressions(String sourceVersion) throws Exception {
         String[] expressions = {
             "(a)",
             "a",
@@ -94,7 +95,7 @@
 
         StringWriter out = new StringWriter();
         JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
-            List.of("--enable-preview", "-source", "13"), null,
+            List.of("--enable-preview", "-source", sourceVersion), null,
             Arrays.asList(new MyFileObject(code.toString())));
         CompilationUnitTree cut = ct.parse().iterator().next();
         Trees trees = Trees.instance(ct);
--- a/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java	Thu Feb 21 10:29:16 2019 -0800
@@ -3,7 +3,7 @@
  * @bug 8206986
  * @summary Verify reasonable errors are produced when neither ':' nor '->'
  *          is found are the expression of a case
- * @compile/fail/ref=SwitchArrowBrokenConstant.out -source 13 --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java
+ * @compile/fail/ref=SwitchArrowBrokenConstant.out -source ${jdk.version} --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java
  */
 
 public class SwitchArrowBrokenConstant {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java	Thu Feb 21 10:29:16 2019 -0800
@@ -3,7 +3,7 @@
  * @bug 8206986
  * @summary Verify rule cases work properly.
  * @compile/fail/ref=SwitchStatementArrow-old.out -source 9 -Xlint:-options -XDrawDiagnostics SwitchStatementArrow.java
- * @compile --enable-preview -source 13 SwitchStatementArrow.java
+ * @compile --enable-preview -source ${jdk.version} SwitchStatementArrow.java
  * @run main/othervm --enable-preview SwitchStatementArrow
  */
 
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify that rule and ordinary cases cannot be mixed.
- * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken.java
+ * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementBroken.java
  */
 
 public class SwitchStatementBroken {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify that not allowed types of statements cannot be used in rule case.
- * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken2.java
+ * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementBroken2.java
  */
 
 public class SwitchStatementBroken2 {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java	Thu Feb 21 10:26:56 2019 -0800
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java	Thu Feb 21 10:29:16 2019 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 8206986
  * @summary Verify that scopes in rule cases are isolated.
- * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementScopesIsolated.java
+ * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementScopesIsolated.java
  */
 
 public class SwitchStatementScopesIsolated {