changeset 51535:27247bfeaf89 switch

Changing switch enhancements to be preview features.
author jlahoda
date Fri, 29 Jun 2018 16:40:37 +0200
parents c2746556c7c9
children 10a0cdfd83ad
files src/jdk.compiler/share/classes/com/sun/source/tree/BreakTree.java src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java src/jdk.compiler/share/classes/com/sun/source/tree/SwitchExpressionTree.java src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties 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/MultipleCaseLabels.java test/langtools/tools/javac/diags/examples/NotExhaustive.java test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.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/lambda/BadSwitchExpressionLambda.out test/langtools/tools/javac/parser/JavacParserTest.java test/langtools/tools/javac/switchexpr/BlockExpression.java test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.out test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out 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/ExpressionSwitchBreaks2.out test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.out test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.out test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.out test/langtools/tools/javac/switchexpr/ParseIncomplete.java test/langtools/tools/javac/switchexpr/ParserRecovery.java test/langtools/tools/javac/switchexpr/ParserRecovery.out test/langtools/tools/javac/switchextra/MultipleLabelsExpression-old.out test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java test/langtools/tools/javac/switchextra/MultipleLabelsStatement-old.out test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java test/langtools/tools/javac/switchextra/SwitchStatementArrow-old.out test/langtools/tools/javac/switchextra/SwitchStatementArrow.java test/langtools/tools/javac/switchextra/SwitchStatementBroken.java test/langtools/tools/javac/switchextra/SwitchStatementBroken.out test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java test/langtools/tools/javac/switchextra/SwitchStatementBroken2.out test/langtools/tools/javac/tree/SourceTreeScannerTest.java test/langtools/tools/javac/tree/TreePosTest.java
diffstat 59 files changed, 164 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/BreakTree.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/BreakTree.java	Fri Jun 29 16:40:37 2018 +0200
@@ -55,7 +55,7 @@
     /**
      * Returns the expression for this {@code break} statement.
      * @return the expression
-     * @since TBD
+     * @since 12
      */
     ExpressionTree getValue();
 }
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java	Fri Jun 29 16:40:37 2018 +0200
@@ -60,7 +60,7 @@
      * Returns the labels for this case.
      * For default case, returns an empty list.
      * @return labels for this case
-     * @since TBD
+     * @since 12
      */
     List<? extends ExpressionTree> getExpressions();
 
@@ -75,13 +75,13 @@
     List<? extends StatementTree> getStatements();
 
     /**
-     * For case with kind {@linkplain CaseKind#ARROW},
+     * For case with kind {@linkplain CaseKind#RULE},
      * return the statement or expression after the arrow.
      * Returns {@code null} for case with kind
      * {@linkplain CaseKind#STATEMENT}.
      * 
      * @return case value or null
-     * @since TBD
+     * @since 12
      */
     public default Tree getBody() {
         return null;
@@ -101,9 +101,9 @@
      * The syntatic form of this case:
      * <ul>
      *     <li>STATEMENT: {@code case <expression>: <statements>}</li>
-     *     <li>ARROW: {@code case <expression> -> <expression>/<statement>}</li>
+     *     <li>RULE: {@code case <expression> -> <expression>/<statement>}</li>
      * </ul>
-     * @since TBD
+     * @since 12
      */
     public enum CaseKind {
         /**
@@ -113,6 +113,6 @@
         /**
          * Case is in the form: {@code case <expression> -> <expression>}.
          */
-        ARROW;
+        RULE;
     }
 }
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/SwitchExpressionTree.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/SwitchExpressionTree.java	Fri Jun 29 16:40:37 2018 +0200
@@ -41,7 +41,7 @@
  *
  * @author Peter von der Ah&eacute;
  * @author Jonathan Gibbons
- * @since TBD
+ * @since 12
  */
 public interface SwitchExpressionTree extends ExpressionTree {
     /**
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java	Fri Jun 29 16:40:37 2018 +0200
@@ -241,7 +241,7 @@
 
         /**
          * Used for instances of {@link SwitchExpressionTree}.
-         * @since TBD
+         * @since 12
          */
         SWITCH_EXPRESSION(SwitchExpressionTree.class),
 
--- a/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java	Fri Jun 29 16:40:37 2018 +0200
@@ -358,7 +358,7 @@
      * @param node the node being visited
      * @param p a parameter value
      * @return a result value
-     * @since TBD
+     * @since 12
      */
     R visitSwitchExpression(SwitchExpressionTree node, P p);
 
--- a/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java	Fri Jun 29 16:40:37 2018 +0200
@@ -358,7 +358,7 @@
     @Override
     public R visitCase(CaseTree node, P p) {
         R r = scan(node.getExpressions(), p);
-        if (node.getCaseKind() == CaseKind.ARROW)
+        if (node.getCaseKind() == CaseKind.RULE)
             r = scanAndReduce(node.getBody(), p, r);
         else
             r = scanAndReduce(node.getStatements(), p, r);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java	Fri Jun 29 16:40:37 2018 +0200
@@ -165,6 +165,10 @@
      * @return true, if given feature is a preview feature.
      */
     public boolean isPreview(Feature feature) {
+        if (feature == Feature.SWITCH_EXPRESSION ||
+            feature == Feature.SWITCH_MULTIPLE_CASE_LABELS ||
+            feature == Feature.SWITCH_RULE)
+            return true;
         //Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing).
         //When real preview features will be added, this method can be implemented to return 'true'
         //for those selected features, and 'false' for all the others.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Fri Jun 29 16:40:37 2018 +0200
@@ -187,8 +187,9 @@
         PRIVATE_INTERFACE_METHODS(JDK9, Fragments.FeaturePrivateIntfMethods, DiagKind.PLURAL),
         LOCAL_VARIABLE_TYPE_INFERENCE(JDK10),
         IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES(JDK1_2, JDK8),
-        SWITCH_MULTIPLE_CASE_LABELS(JDK10, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
-        SWITCH_EXPRESSION(JDK10, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL);
+        SWITCH_MULTIPLE_CASE_LABELS(JDK12, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
+        SWITCH_RULE(JDK12, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
+        SWITCH_EXPRESSION(JDK12, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL);
 
         enum DiagKind {
             NORMAL,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Jun 29 16:40:37 2018 +0200
@@ -3380,7 +3380,7 @@
         }
         
         for (JCCase c : cases) {
-            if (c.caseKind == CaseKind.ARROW && c.completesNormally) {
+            if (c.caseKind == CaseKind.RULE && c.completesNormally) {
                 JCBreak b = make_at(c.pos()).Break(null);
                 b.target = tree;
                 c.stats = c.stats.append(b);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1411,16 +1411,17 @@
         CaseKind kind;
         switch (token.kind) {
             case ARROW:
+                checkSourceLevel(Feature.SWITCH_RULE);
                 nextToken();
                 if (token.kind == TokenKind.THROW || token.kind == TokenKind.LBRACE) {
                     stats = List.of(parseStatement());
                     body = stats.head;
-                    kind = CaseKind.ARROW;
+                    kind = CaseKind.RULE;
                 } else {
                     JCExpression value = parseExpression();
                     stats = List.of(to(F.at(value).Break(value)));
                     body = value;
-                    kind = CaseKind.ARROW;
+                    kind = CaseKind.RULE;
                     accept(SEMI);
                 }
                 break;
@@ -2817,8 +2818,9 @@
             CaseKind caseKind;
             JCTree body = null;
             if (token.kind == ARROW) {
+                checkSourceLevel(Feature.SWITCH_RULE);
                 accept(ARROW);
-                caseKind = CaseKind.ARROW;
+                caseKind = CaseKind.RULE;
                 JCStatement statement = parseStatementAsBlock();
                 if (!statement.hasTag(EXEC) && !statement.hasTag(BLOCK) && !statement.hasTag(Tag.THROW)) {
                     log.error(statement.pos(), Errors.SwitchCaseUnexpectedStatement);
@@ -2844,8 +2846,9 @@
                 caseKind = CaseKind.STATEMENT;
                 stats = blockStatements();
             } else {
+                checkSourceLevel(Feature.SWITCH_RULE);
                 accept(ARROW);
-                caseKind = CaseKind.ARROW;
+                caseKind = CaseKind.RULE;
                 JCStatement statement = parseStatementAsBlock();
                 if (!statement.hasTag(EXEC) && !statement.hasTag(BLOCK) && !statement.hasTag(Tag.THROW)) {
                     log.error(statement.pos(), Errors.SwitchCaseUnexpectedStatement);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jun 29 13:42:14 2018 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jun 29 16:40:37 2018 +0200
@@ -2822,6 +2822,9 @@
 compiler.misc.feature.multiple.case.labels=\
     multiple case labels
 
+compiler.misc.feature.switch.rules=\
+    switch rules
+
 compiler.misc.feature.switch.expressions=\
     switch expressions
 
--- a/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.warn.break.ambiguous.target
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class BreakAmbiguousTarget {
     void m(int i, int j) {
--- a/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.break.expr.not.immediate
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class BreakExprNotImmediate {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/BreakMissingValue.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/BreakMissingValue.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.break.missing.value
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class BreakMissingValue {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.break.outside.switch.expression
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class BreakOutsideSwitchExpression {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.continue.outside.switch.expression
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class ContinueOutsideSwitchExpression {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,8 +22,8 @@
  */
 
 // key: compiler.misc.feature.multiple.case.labels
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 11
+// key: compiler.warn.preview.feature.use.plural
+// options: --enable-preview -source 12 -Xlint:preview
 
 class MultipleCaseLabels {
     void m(int i) {
--- a/test/langtools/tools/javac/diags/examples/NotExhaustive.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/NotExhaustive.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.not.exhaustive
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class NotExhaustive {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.return.outside.switch.expression
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class ReturnOutsideSwitchExpression {
     int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.switch.case.unexpected.statement
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class ReturnOutsideSwitchExpression {
     void t(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java	Fri Jun 29 16:40:37 2018 +0200
@@ -24,6 +24,9 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.incompatible.ret.type.in.lambda
 // key: compiler.misc.switch.expression.target.cant.be.void
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class SwitchExpressionTargetCantBeVoid {
 
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressions.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressions.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,13 +22,13 @@
  */
 
 // key: compiler.misc.feature.switch.expressions
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 11
+// key: compiler.warn.preview.feature.use.plural
+// options: --enable-preview -source 12 -Xlint:preview
 
 class SwitchExpressions {
     int m(int i) {
         return switch (i) {
-            default -> -1;
+            default: break -1;
         };
     }
 }
--- a/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java	Fri Jun 29 16:40:37 2018 +0200
@@ -22,6 +22,9 @@
  */
 
 // key: compiler.err.switch.mixing.case.types
+// key: compiler.note.preview.filename
+// key: compiler.note.preview.recompile
+// options: --enable-preview -source 12
 
 class SwitchMixingCaseTypes {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/SwitchRules.java	Fri Jun 29 16:40:37 2018 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.feature.switch.rules
+// key: compiler.warn.preview.feature.use.plural
+// options: --enable-preview -source 12 -Xlint:preview
+
+class SwitchExpressions {
+    void m(int i) {
+        switch (i) {
+            default -> { break; }
+        };
+    }
+}
--- a/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java	Fri Jun 29 16:40:37 2018 +0200
@@ -77,6 +77,7 @@
 
     private void assertOK(String... constructs) {
         reset();
+        addCompileOptions("--enable-preview", "-source", "12");
         program(constructs);
         try {
             compile();
@@ -89,6 +90,7 @@
 
     private void assertOKWithWarning(String warning, String... constructs) {
         reset();
+        addCompileOptions("--enable-preview", "-source", "12");
         program(constructs);
         try {
             compile();
@@ -101,6 +103,7 @@
 
     private void assertFail(String expectedDiag, String... constructs) {
         reset();
+        addCompileOptions("--enable-preview", "-source", "12");
         program(constructs);
         try {
             compile();
--- a/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary Adding switch expressions
- * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics BadSwitchExpressionLambda.java
+ * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source 12 BadSwitchExpressionLambda.java
  */
 
 class BadSwitchExpressionLambda {
--- a/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,2 +1,4 @@
 BadSwitchExpressionLambda.java:17:26: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.switch.expression.target.cant.be.void))
+- compiler.note.preview.filename: BadSwitchExpressionLambda.java
+- compiler.note.preview.recompile
 1 error
--- a/test/langtools/tools/javac/parser/JavacParserTest.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/parser/JavacParserTest.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1075,7 +1075,8 @@
         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"), null, Arrays.asList(new MyFileObject(code)));
+                Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", "12"),
+                null, Arrays.asList(new MyFileObject(code)));
 
         CompilationUnitTree cut = ct.parse().iterator().next();
         Trees trees = Trees.instance(ct);
--- a/test/langtools/tools/javac/switchexpr/BlockExpression.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/BlockExpression.java	Fri Jun 29 16:40:37 2018 +0200
@@ -23,8 +23,8 @@
 
 /**
  * @test
- * @compile BlockExpression.java
- * @run main BlockExpression
+ * @compile --enable-preview -source 12 BlockExpression.java
+ * @run main/othervm --enable-preview BlockExpression
  */
 
 public class BlockExpression {
--- a/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,6 +1,6 @@
 /**
  * @test /nodynamiccopyright/
- * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics BooleanNumericNonNumeric.java
+ * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source 12 BooleanNumericNonNumeric.java
  */
 
 public class BooleanNumericNonNumeric {
--- a/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,3 +1,5 @@
 BooleanNumericNonNumeric.java:9:20: compiler.err.operator.cant.be.applied.1: +, int, boolean
 BooleanNumericNonNumeric.java:17:15: compiler.err.cant.deref: int
+- compiler.note.preview.filename: BooleanNumericNonNumeric.java
+- compiler.note.preview.recompile
 2 errors
--- a/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java	Fri Jun 29 16:40:37 2018 +0200
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @compile ExhaustiveEnumSwitch.java
+ * @compile --enable-preview -source 12 ExhaustiveEnumSwitch.java
  * @compile ExhaustiveEnumSwitchExtra.java
- * @run main ExhaustiveEnumSwitch
+ * @run main/othervm --enable-preview ExhaustiveEnumSwitch
  */
 
 public class ExhaustiveEnumSwitch {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch-old.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,2 +1,3 @@
-ExpressionSwitch.java:23:16: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.expressions), 9, 10
-1 error
+ExpressionSwitch.java:23:16: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.expressions)
+ExpressionSwitch.java:24:20: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.rules)
+2 errors
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,8 +1,8 @@
 /**
  * @test /nodynamiccopyright/
  * @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java
- * @compile ExpressionSwitch.java
- * @run main ExpressionSwitch
+ * @compile --enable-preview -source 12 ExpressionSwitch.java
+ * @run main/othervm --enable-preview ExpressionSwitch
  */
 
 import java.util.Objects;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java	Fri Jun 29 16:40:37 2018 +0200
@@ -23,8 +23,8 @@
 
 /**
  * @test
- * @compile ExpressionSwitchBreaks1.java
- * @run main ExpressionSwitchBreaks1
+ * @compile --enable-preview -source 12 ExpressionSwitchBreaks1.java
+ * @run main/othervm --enable-preview ExpressionSwitchBreaks1
  */
 
 import java.util.Objects;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,6 +1,6 @@
 /**
  * @test /nodynamiccopyright/
- * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics ExpressionSwitchBreaks2.java
+ * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchBreaks2.java
  */
 
 public class ExpressionSwitchBreaks2 {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.out	Fri Jun 29 16:40:37 2018 +0200
@@ -10,5 +10,7 @@
 ExpressionSwitchBreaks2.java:38:29: compiler.err.cant.resolve.location: kindname.variable, undef, , , (compiler.misc.location: kindname.class, ExpressionSwitchBreaks2, null)
 ExpressionSwitchBreaks2.java:42:22: compiler.warn.break.ambiguous.target: j
 ExpressionSwitchBreaks2.java:45:22: compiler.err.break.outside.switch.expression
+- compiler.note.preview.filename: ExpressionSwitchBreaks2.java
+- compiler.note.preview.recompile
 10 errors
 2 warnings
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java	Fri Jun 29 16:40:37 2018 +0200
@@ -23,8 +23,8 @@
 
 /**
  * @test
- * @compile ExpressionSwitchBugs.java
- * @run main ExpressionSwitchBugs
+ * @compile --enable-preview -source 12 ExpressionSwitchBugs.java
+ * @run main/othervm --enable-preview ExpressionSwitchBugs
  */
 
 public class ExpressionSwitchBugs {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java	Fri Jun 29 16:40:37 2018 +0200
@@ -23,8 +23,8 @@
 
 /**
  * @test
- * @compile ExpressionSwitchFallThrough.java
- * @run main ExpressionSwitchFallThrough
+ * @compile --enable-preview -source 12 ExpressionSwitchFallThrough.java
+ * @run main/othervm --enable-preview ExpressionSwitchFallThrough
  */
 
 import java.util.Objects;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java	Fri Jun 29 16:40:37 2018 +0200
@@ -23,8 +23,8 @@
 
 /**
  * @test
- * @compile ExpressionSwitchFallThrough1.java
- * @run main ExpressionSwitchFallThrough1
+ * @compile --enable-preview -source 12 ExpressionSwitchFallThrough1.java
+ * @run main/othervm --enable-preview ExpressionSwitchFallThrough1
  */
 
 import java.util.Objects;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,6 +1,6 @@
 /**
  * @test /nodynamiccopyright/
- * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics ExpressionSwitchInfer.java
+ * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchInfer.java
  */
 
 import java.util.ArrayList;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,3 +1,5 @@
 ExpressionSwitchInfer.java:16:95: compiler.err.cant.resolve.location.args: kindname.method, substring, , int, (compiler.misc.location: kindname.interface, java.lang.CharSequence, null)
 ExpressionSwitchInfer.java:25:38: compiler.err.cant.resolve.location.args: kindname.method, substring, , int, (compiler.misc.location: kindname.interface, java.lang.CharSequence, null)
+- compiler.note.preview.filename: ExpressionSwitchInfer.java
+- compiler.note.preview.recompile
 2 errors
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,6 +1,6 @@
 /**
  * @test /nodynamiccopyright/
- * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics ExpressionSwitchNotExhaustive.java
+ * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchNotExhaustive.java
  */
 
 public class ExpressionSwitchNotExhaustive {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,4 +1,6 @@
 ExpressionSwitchNotExhaustive.java:8:16: compiler.err.not.exhaustive
 ExpressionSwitchNotExhaustive.java:14:16: compiler.err.not.exhaustive
 ExpressionSwitchNotExhaustive.java:27:23: compiler.err.var.might.not.have.been.initialized: s
+- compiler.note.preview.filename: ExpressionSwitchNotExhaustive.java
+- compiler.note.preview.recompile
 3 errors
--- a/test/langtools/tools/javac/switchexpr/ParseIncomplete.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ParseIncomplete.java	Fri Jun 29 16:40:37 2018 +0200
@@ -66,7 +66,8 @@
             StringWriter out = new StringWriter();
             try {
                 JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
-                    List.of("-XDdev"), null, Arrays.asList(new MyFileObject(code)));
+                    List.of("-XDdev", "--enable-preview", "-source", "12"), null,
+                    Arrays.asList(new MyFileObject(code)));
                 ct.parse().iterator().next();
             } catch (Throwable t) {
                 System.err.println("Unexpected exception for code: " + code);
--- a/test/langtools/tools/javac/switchexpr/ParserRecovery.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ParserRecovery.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,6 +1,6 @@
 /**
  * @test /nodynamiccopyright/
- * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics ParserRecovery.java
+ * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source 12 ParserRecovery.java
  */
 
 public class ParserRecovery {
--- a/test/langtools/tools/javac/switchexpr/ParserRecovery.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchexpr/ParserRecovery.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,3 +1,5 @@
 ParserRecovery.java:8:39: compiler.err.expected: :
 ParserRecovery.java:11:31: compiler.err.expected: :
+- compiler.note.preview.filename: ParserRecovery.java
+- compiler.note.preview.recompile
 2 errors
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsExpression-old.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsExpression-old.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,3 +1,4 @@
-MultipleLabelsExpression.java:29:16: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.expressions), 9, 10
-MultipleLabelsExpression.java:31:19: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.multiple.case.labels), 9, 10
-2 errors
+MultipleLabelsExpression.java:29:16: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.expressions)
+MultipleLabelsExpression.java:30:20: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.rules)
+MultipleLabelsExpression.java:31:19: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.multiple.case.labels)
+3 errors
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,8 +1,8 @@
 /**
  * @test /nodynamiccopyright/
  * @compile/fail/ref=MultipleLabelsExpression-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsExpression.java
- * @compile MultipleLabelsExpression.java
- * @run main MultipleLabelsExpression
+ * @compile --enable-preview -source 12 MultipleLabelsExpression.java
+ * @run main/othervm --enable-preview MultipleLabelsExpression
  */
 
 import java.util.Objects;
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsStatement-old.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsStatement-old.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,2 +1,2 @@
-MultipleLabelsStatement.java:33:21: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.multiple.case.labels), 9, 10
+MultipleLabelsStatement.java:33:21: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.multiple.case.labels)
 1 error
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,8 +1,8 @@
 /**
  * @test /nodynamiccopyright/
  * @compile/fail/ref=MultipleLabelsStatement-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsStatement.java
- * @compile MultipleLabelsStatement.java
- * @run main MultipleLabelsStatement
+ * @compile --enable-preview -source 12 MultipleLabelsStatement.java
+ * @run main/othervm --enable-preview MultipleLabelsStatement
  */
 
 import java.util.Objects;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementArrow-old.out	Fri Jun 29 16:40:37 2018 +0200
@@ -0,0 +1,3 @@
+SwitchStatementArrow.java:38:20: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.rules)
+SwitchStatementArrow.java:39:21: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.multiple.case.labels)
+2 errors
--- a/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,30 +1,8 @@
-/*
- * Copyright (c) 2018, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
 /**
- * @test
- * @compile SwitchStatementArrow.java
- * @run main SwitchStatementArrow
+ * @test /nodymaticcopyright/
+ * @compile/fail/ref=SwitchStatementArrow-old.out -source 9 -Xlint:-options -XDrawDiagnostics SwitchStatementArrow.java
+ * @compile --enable-preview -source 12 SwitchStatementArrow.java
+ * @run main/othervm --enable-preview SwitchStatementArrow
  */
 
 import java.util.Objects;
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,6 +1,6 @@
 /**
  * @test /nodynamiccopyright/
- * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics SwitchStatementBroken.java
+ * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source 12 SwitchStatementBroken.java
  */
 
 public class SwitchStatementBroken {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken.out	Fri Jun 29 16:40:37 2018 +0200
@@ -1,2 +1,4 @@
 SwitchStatementBroken.java:13:13: compiler.err.switch.mixing.case.types
+- compiler.note.preview.filename: SwitchStatementBroken.java
+- compiler.note.preview.recompile
 1 error
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java	Fri Jun 29 16:40:37 2018 +0200
@@ -1,6 +1,6 @@
 /** /nodynamiccopyright/
  * @test
- * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics SwitchStatementBroken2.java
+ * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source 12 SwitchStatementBroken2.java
  */
 
 public class SwitchStatementBroken2 {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.out	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.out	Fri Jun 29 16:40:37 2018 +0200
@@ -2,4 +2,6 @@
 SwitchStatementBroken2.java:16:23: compiler.err.switch.case.unexpected.statement
 SwitchStatementBroken2.java:17:23: compiler.err.switch.case.unexpected.statement
 SwitchStatementBroken2.java:20:24: compiler.err.switch.case.unexpected.statement
+- compiler.note.preview.filename: SwitchStatementBroken2.java
+- compiler.note.preview.recompile
 4 errors
--- a/test/langtools/tools/javac/tree/SourceTreeScannerTest.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/tree/SourceTreeScannerTest.java	Fri Jun 29 16:40:37 2018 +0200
@@ -154,7 +154,7 @@
                             // but the embedded annotations will be.
                             reflectiveScan(((JCModuleDecl) tree).mods.annotations);
                         } else if (tree instanceof JCCase &&
-                                   ((JCCase) tree).getCaseKind() == CaseKind.ARROW &&
+                                   ((JCCase) tree).getCaseKind() == CaseKind.RULE &&
                                    f.getName().equals("stats")) {
                             //value case, visit value:
                             reflectiveScan(((JCCase) tree).getBody());
--- a/test/langtools/tools/javac/tree/TreePosTest.java	Fri Jun 29 13:42:14 2018 +0200
+++ b/test/langtools/tools/javac/tree/TreePosTest.java	Fri Jun 29 16:40:37 2018 +0200
@@ -444,7 +444,7 @@
 
         @Override
         public void visitCase(JCCase tree) {
-            if (tree.getCaseKind() == CaseKind.ARROW) {
+            if (tree.getCaseKind() == CaseKind.RULE) {
                 scan(tree.getBody());
             } else {
                 super.visitCase(tree);