8232684: Make switch expressions final

Reviewed-by: alanb, mcimadamore, kvn
This commit is contained in:
Jan Lahoda 2019-11-12 06:32:13 +00:00
parent f390c87d8d
commit 29852ecd80
134 changed files with 139 additions and 396 deletions

View file

@ -54,7 +54,6 @@ public @interface PreviewFeature {
public boolean essentialAPI() default false; public boolean essentialAPI() default false;
public enum Feature { public enum Feature {
SWITCH_EXPRESSIONS,
TEXT_BLOCKS; TEXT_BLOCKS;
} }
} }

View file

@ -51,29 +51,18 @@ public interface CaseTree extends Tree {
* {@code null} if this is the default case. * {@code null} if this is the default case.
* If this case has multiple labels, returns the first label. * If this case has multiple labels, returns the first label.
* @return the expression for the case, or null * @return the expression for the case, or null
* @deprecated Please use {@link #getExpressions()}.
*/ */
@Deprecated
ExpressionTree getExpression(); ExpressionTree getExpression();
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns the labels for this case. * Returns the labels for this case.
* For default case, returns an empty list. * For default case, returns an empty list.
* *
* @return labels for this case * @return labels for this case
* @since 12 * @since 12
*
* @preview This method is modeling a case with multiple labels,
* which is part of a preview feature and may be removed
* if the preview feature is removed.
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
List<? extends ExpressionTree> getExpressions(); List<? extends ExpressionTree> getExpressions();
/** /**
@ -86,14 +75,6 @@ public interface CaseTree extends Tree {
List<? extends StatementTree> getStatements(); List<? extends StatementTree> getStatements();
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* For case with kind {@linkplain CaseKind#RULE}, * For case with kind {@linkplain CaseKind#RULE},
* returns the statement or expression after the arrow. * returns the statement or expression after the arrow.
* Returns {@code null} for case with kind * Returns {@code null} for case with kind
@ -102,40 +83,21 @@ public interface CaseTree extends Tree {
* @return case value or null * @return case value or null
* @since 12 * @since 12
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
public default Tree getBody() { public default Tree getBody() {
return null; return null;
} }
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns the kind of this case. * Returns the kind of this case.
* *
* @return the kind of this case * @return the kind of this case
* @since 12 * @since 12
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
public default CaseKind getCaseKind() { public default CaseKind getCaseKind() {
return CaseKind.STATEMENT; return CaseKind.STATEMENT;
} }
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This enum is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The syntatic form of this case: * The syntatic form of this case:
* <ul> * <ul>
* <li>STATEMENT: {@code case <expression>: <statements>}</li> * <li>STATEMENT: {@code case <expression>: <statements>}</li>
@ -144,8 +106,6 @@ public interface CaseTree extends Tree {
* *
* @since 12 * @since 12
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
public enum CaseKind { public enum CaseKind {
/** /**
* Case is in the form: {@code case <expression>: <statements>}. * Case is in the form: {@code case <expression>: <statements>}.

View file

@ -28,14 +28,6 @@ package com.sun.source.tree;
import java.util.List; import java.util.List;
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This interface is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* A tree node for a {@code switch} expression. * A tree node for a {@code switch} expression.
* *
* For example: * For example:
@ -49,7 +41,6 @@ import java.util.List;
* *
* @since 12 * @since 12
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
public interface SwitchExpressionTree extends ExpressionTree { public interface SwitchExpressionTree extends ExpressionTree {
/** /**
* Returns the expression for the {@code switch} expression. * Returns the expression for the {@code switch} expression.

View file

@ -240,20 +240,10 @@ public interface Tree {
SWITCH(SwitchTree.class), SWITCH(SwitchTree.class),
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This enum constant is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Used for instances of {@link SwitchExpressionTree}. * Used for instances of {@link SwitchExpressionTree}.
* *
* @since 12 * @since 12
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
SWITCH_EXPRESSION(SwitchExpressionTree.class), SWITCH_EXPRESSION(SwitchExpressionTree.class),
/** /**
@ -662,20 +652,10 @@ public interface Tree {
OTHER(null), OTHER(null),
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This enum constant is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Used for instances of {@link YieldTree}. * Used for instances of {@link YieldTree}.
* *
* @since 13 * @since 13
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
YIELD(YieldTree.class); YIELD(YieldTree.class);

View file

@ -354,14 +354,6 @@ public interface TreeVisitor<R,P> {
R visitSwitch(SwitchTree node, P p); R visitSwitch(SwitchTree node, P p);
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Visits a SwitchExpressionTree node. * Visits a SwitchExpressionTree node.
* *
* @param node the node being visited * @param node the node being visited
@ -369,8 +361,6 @@ public interface TreeVisitor<R,P> {
* @return a result value * @return a result value
* @since 12 * @since 12
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
R visitSwitchExpression(SwitchExpressionTree node, P p); R visitSwitchExpression(SwitchExpressionTree node, P p);
/** /**
@ -560,21 +550,11 @@ public interface TreeVisitor<R,P> {
R visitOther(Tree node, P p); R visitOther(Tree node, P p);
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Visits a YieldTree node. * Visits a YieldTree node.
* @param node the node being visited * @param node the node being visited
* @param p a parameter value * @param p a parameter value
* @return a result value * @return a result value
* @since 13 * @since 13
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
R visitYield(YieldTree node, P p); R visitYield(YieldTree node, P p);
} }

View file

@ -26,14 +26,6 @@
package com.sun.source.tree; package com.sun.source.tree;
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* A tree node for a {@code yield} statement. * A tree node for a {@code yield} statement.
* *
* For example: * For example:
@ -45,7 +37,6 @@ package com.sun.source.tree;
* *
* @since 13 * @since 13
*/ */
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
public interface YieldTree extends StatementTree { public interface YieldTree extends StatementTree {
/** /**

View file

@ -264,14 +264,6 @@ public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
} }
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* {@inheritDoc} This implementation calls {@code defaultAction}. * {@inheritDoc} This implementation calls {@code defaultAction}.
* *
* @param node {@inheritDoc} * @param node {@inheritDoc}
@ -279,8 +271,6 @@ public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
* @return the result of {@code defaultAction} * @return the result of {@code defaultAction}
*/ */
@Override @Override
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
public R visitSwitchExpression(SwitchExpressionTree node, P p) { public R visitSwitchExpression(SwitchExpressionTree node, P p) {
return defaultAction(node, p); return defaultAction(node, p);
} }
@ -794,8 +784,6 @@ public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
* @return the result of {@code defaultAction} * @return the result of {@code defaultAction}
*/ */
@Override @Override
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
public R visitYield(YieldTree node, P p) { public R visitYield(YieldTree node, P p) {
return defaultAction(node, p); return defaultAction(node, p);
} }

View file

@ -334,14 +334,6 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
} }
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* {@inheritDoc} This implementation scans the children in left to right order. * {@inheritDoc} This implementation scans the children in left to right order.
* *
* @param node {@inheritDoc} * @param node {@inheritDoc}
@ -349,8 +341,6 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
* @return the result of scanning * @return the result of scanning
*/ */
@Override @Override
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
public R visitSwitchExpression(SwitchExpressionTree node, P p) { public R visitSwitchExpression(SwitchExpressionTree node, P p) {
R r = scan(node.getExpression(), p); R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getCases(), p, r); r = scanAndReduce(node.getCases(), p, r);
@ -365,7 +355,6 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
* @return the result of scanning * @return the result of scanning
*/ */
@Override @Override
@SuppressWarnings("preview")
public R visitCase(CaseTree node, P p) { public R visitCase(CaseTree node, P p) {
R r = scan(node.getExpressions(), p); R r = scan(node.getExpressions(), p);
if (node.getCaseKind() == CaseTree.CaseKind.RULE) if (node.getCaseKind() == CaseTree.CaseKind.RULE)
@ -938,14 +927,6 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
} }
/** /**
* {@preview Associated with switch expressions, a preview feature of
* the Java language.
*
* This method is associated with <i>switch expressions</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* {@inheritDoc} This implementation returns {@code null}. * {@inheritDoc} This implementation returns {@code null}.
* *
* @param node {@inheritDoc} * @param node {@inheritDoc}
@ -953,8 +934,6 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
* @return the result of scanning * @return the result of scanning
*/ */
@Override @Override
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
@SuppressWarnings("preview")
public R visitYield(YieldTree node, P p) { public R visitYield(YieldTree node, P p) {
return scan(node.getValue(), p); return scan(node.getValue(), p);
} }

View file

@ -165,10 +165,7 @@ public class Preview {
* @return true, if given feature is a preview feature. * @return true, if given feature is a preview feature.
*/ */
public boolean isPreview(Feature feature) { public boolean isPreview(Feature feature) {
if (feature == Feature.SWITCH_EXPRESSION || if (feature == Feature.TEXT_BLOCKS)
feature == Feature.SWITCH_MULTIPLE_CASE_LABELS ||
feature == Feature.SWITCH_RULE ||
feature == Feature.TEXT_BLOCKS)
return true; return true;
//Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing). //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' //When real preview features will be added, this method can be implemented to return 'true'

View file

@ -1467,7 +1467,6 @@ public class Attr extends JCTree.Visitor {
// check that there are no duplicate case labels or default clauses. // check that there are no duplicate case labels or default clauses.
Set<Object> labels = new HashSet<>(); // The set of case labels. Set<Object> labels = new HashSet<>(); // The set of case labels.
boolean hasDefault = false; // Is there a default label? boolean hasDefault = false; // Is there a default label?
@SuppressWarnings("preview")
CaseTree.CaseKind caseKind = null; CaseTree.CaseKind caseKind = null;
boolean wasError = false; boolean wasError = false;
for (List<JCCase> l = cases; l.nonEmpty(); l = l.tail) { for (List<JCCase> l = cases; l.nonEmpty(); l = l.tail) {

View file

@ -1432,7 +1432,6 @@ public class JavacParser implements Parser {
} }
List<JCStatement> stats = null; List<JCStatement> stats = null;
JCTree body = null; JCTree body = null;
@SuppressWarnings("preview")
CaseTree.CaseKind kind; CaseTree.CaseKind kind;
switch (token.kind) { switch (token.kind) {
case ARROW: case ARROW:
@ -2897,7 +2896,6 @@ public class JavacParser implements Parser {
nextToken(); nextToken();
checkSourceLevel(Feature.SWITCH_MULTIPLE_CASE_LABELS); checkSourceLevel(Feature.SWITCH_MULTIPLE_CASE_LABELS);
}; };
@SuppressWarnings("preview")
CaseTree.CaseKind caseKind; CaseTree.CaseKind caseKind;
JCTree body = null; JCTree body = null;
if (token.kind == ARROW) { if (token.kind == ARROW) {
@ -2922,7 +2920,6 @@ public class JavacParser implements Parser {
} }
case DEFAULT: { case DEFAULT: {
nextToken(); nextToken();
@SuppressWarnings("preview")
CaseTree.CaseKind caseKind; CaseTree.CaseKind caseKind;
JCTree body = null; JCTree body = null;
if (token.kind == ARROW) { if (token.kind == ARROW) {
@ -3300,7 +3297,7 @@ public class JavacParser implements Parser {
if (allowYieldStatement) { if (allowYieldStatement) {
return true; return true;
} else if (shouldWarn) { } else if (shouldWarn) {
log.warning(pos, Warnings.RestrictedTypeNotAllowedPreview(name, Source.JDK13)); log.warning(pos, Warnings.RestrictedTypeNotAllowed(name, Source.JDK14));
} }
} }
return false; return false;

View file

@ -1249,17 +1249,14 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
public static class JCCase extends JCStatement implements CaseTree { public static class JCCase extends JCStatement implements CaseTree {
//as CaseKind is deprecated for removal (as it is part of a preview feature), //as CaseKind is deprecated for removal (as it is part of a preview feature),
//using indirection through these fields to avoid unnecessary @SuppressWarnings: //using indirection through these fields to avoid unnecessary @SuppressWarnings:
@SuppressWarnings("preview")
public static final CaseKind STATEMENT = CaseKind.STATEMENT; public static final CaseKind STATEMENT = CaseKind.STATEMENT;
@SuppressWarnings("preview")
public static final CaseKind RULE = CaseKind.RULE; public static final CaseKind RULE = CaseKind.RULE;
@SuppressWarnings("preview")
public final CaseKind caseKind; public final CaseKind caseKind;
public List<JCExpression> pats; public List<JCExpression> pats;
public List<JCStatement> stats; public List<JCStatement> stats;
public JCTree body; public JCTree body;
public boolean completesNormally; public boolean completesNormally;
protected JCCase(@SuppressWarnings("preview") CaseKind caseKind, List<JCExpression> pats, protected JCCase(CaseKind caseKind, List<JCExpression> pats,
List<JCStatement> stats, JCTree body) { List<JCStatement> stats, JCTree body) {
Assert.checkNonNull(pats); Assert.checkNonNull(pats);
Assert.check(pats.isEmpty() || pats.head != null); Assert.check(pats.isEmpty() || pats.head != null);
@ -1273,21 +1270,17 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
@Override @DefinedBy(Api.COMPILER_TREE) @Override @DefinedBy(Api.COMPILER_TREE)
public Kind getKind() { return Kind.CASE; } public Kind getKind() { return Kind.CASE; }
@Override @DefinedBy(Api.COMPILER_TREE) @Override @Deprecated @DefinedBy(Api.COMPILER_TREE)
public JCExpression getExpression() { return pats.head; } public JCExpression getExpression() { return pats.head; }
@Override @DefinedBy(Api.COMPILER_TREE) @Override @DefinedBy(Api.COMPILER_TREE)
@SuppressWarnings("preview")
public List<JCExpression> getExpressions() { return pats; } public List<JCExpression> getExpressions() { return pats; }
@Override @DefinedBy(Api.COMPILER_TREE) @Override @DefinedBy(Api.COMPILER_TREE)
@SuppressWarnings("preview")
public List<JCStatement> getStatements() { public List<JCStatement> getStatements() {
return caseKind == CaseKind.STATEMENT ? stats : null; return caseKind == CaseKind.STATEMENT ? stats : null;
} }
@Override @DefinedBy(Api.COMPILER_TREE) @Override @DefinedBy(Api.COMPILER_TREE)
@SuppressWarnings("preview")
public JCTree getBody() { return body; } public JCTree getBody() { return body; }
@Override @DefinedBy(Api.COMPILER_TREE) @Override @DefinedBy(Api.COMPILER_TREE)
@SuppressWarnings("preview")
public CaseKind getCaseKind() { public CaseKind getCaseKind() {
return caseKind; return caseKind;
} }
@ -1304,7 +1297,6 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
/** /**
* A "switch ( ) { }" construction. * A "switch ( ) { }" construction.
*/ */
@SuppressWarnings("preview")
public static class JCSwitchExpression extends JCPolyExpression implements SwitchExpressionTree { public static class JCSwitchExpression extends JCPolyExpression implements SwitchExpressionTree {
public JCExpression selector; public JCExpression selector;
public List<JCCase> cases; public List<JCCase> cases;
@ -1585,7 +1577,6 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
/** /**
* A break-with from a switch expression. * A break-with from a switch expression.
*/ */
@SuppressWarnings("preview")
public static class JCYield extends JCStatement implements YieldTree { public static class JCYield extends JCStatement implements YieldTree {
public JCExpression value; public JCExpression value;
public JCTree target; public JCTree target;
@ -3104,7 +3095,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
JCLabeledStatement Labelled(Name label, JCStatement body); JCLabeledStatement Labelled(Name label, JCStatement body);
JCSwitch Switch(JCExpression selector, List<JCCase> cases); JCSwitch Switch(JCExpression selector, List<JCCase> cases);
JCSwitchExpression SwitchExpression(JCExpression selector, List<JCCase> cases); JCSwitchExpression SwitchExpression(JCExpression selector, List<JCCase> cases);
JCCase Case(@SuppressWarnings("preview") CaseTree.CaseKind caseKind, List<JCExpression> pat, JCCase Case(CaseTree.CaseKind caseKind, List<JCExpression> pat,
List<JCStatement> stats, JCTree body); List<JCStatement> stats, JCTree body);
JCSynchronized Synchronized(JCExpression lock, JCBlock body); JCSynchronized Synchronized(JCExpression lock, JCBlock body);
JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer); JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);

View file

@ -144,7 +144,6 @@ public class TreeCopier<P> implements TreeVisitor<JCTree,P> {
} }
@DefinedBy(Api.COMPILER_TREE) @DefinedBy(Api.COMPILER_TREE)
@SuppressWarnings("preview")
public JCTree visitYield(YieldTree node, P p) { public JCTree visitYield(YieldTree node, P p) {
JCYield t = (JCYield) node; JCYield t = (JCYield) node;
JCExpression value = copy(t.value, p); JCExpression value = copy(t.value, p);
@ -380,7 +379,6 @@ public class TreeCopier<P> implements TreeVisitor<JCTree,P> {
} }
@DefinedBy(Api.COMPILER_TREE) @DefinedBy(Api.COMPILER_TREE)
@SuppressWarnings("preview")
public JCTree visitSwitchExpression(SwitchExpressionTree node, P p) { public JCTree visitSwitchExpression(SwitchExpressionTree node, P p) {
JCSwitchExpression t = (JCSwitchExpression) node; JCSwitchExpression t = (JCSwitchExpression) node;
JCExpression selector = copy(t.selector, p); JCExpression selector = copy(t.selector, p);

View file

@ -274,7 +274,7 @@ public class TreeMaker implements JCTree.Factory {
return tree; return tree;
} }
public JCCase Case(@SuppressWarnings("preview") CaseTree.CaseKind caseKind, List<JCExpression> pats, public JCCase Case(CaseTree.CaseKind caseKind, List<JCExpression> pats,
List<JCStatement> stats, JCTree body) { List<JCStatement> stats, JCTree body) {
JCCase tree = new JCCase(caseKind, pats, stats, body); JCCase tree = new JCCase(caseKind, pats, stats, body);
tree.pos = pos; tree.pos = pos;

View file

@ -78,7 +78,7 @@ class TestMT {
public void run() { public void run() {
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
TestMT.run(getName()); TestMT.run(getName());
yield(); Thread.yield();
} }
} }
} }

View file

@ -180,7 +180,7 @@ class Escaper extends Thread {
while ( ThreadCount.get() > 0 ) { while ( ThreadCount.get() > 0 ) {
int buf[] = new int[32]; int buf[] = new int[32];
{ {
yield(); Thread.yield();
} }
} }
} }

View file

@ -76,7 +76,7 @@ public class b4446672 {
System.out.println ("GCThread synchronized."); System.out.println ("GCThread synchronized.");
while (!done) { while (!done) {
gcing=true; gcing=true;
yield(); Thread.yield();
System.gc(); System.gc();
} }
} }

View file

@ -362,7 +362,7 @@ class RunningThread extends Thread {
currentDepth++; currentDepth++;
if (maxDepth > currentDepth) { if (maxDepth > currentDepth) {
yield(); Thread.yield();
if (mixed) { if (mixed) {
int result = recursionNative(maxDepth, currentDepth, true); int result = recursionNative(maxDepth, currentDepth, true);

View file

@ -232,7 +232,7 @@ abstract public class JDIEventsDebuggee extends AbstractJDIDebuggee {
public void run() { public void run() {
while (!startExecution) while (!startExecution)
yield(); Thread.yield();
for (int i = 0; (i < actionsNumber) && !stopExecution; i++) for (int i = 0; (i < actionsNumber) && !stopExecution; i++)
executor.doEventAction(); executor.doEventAction();

View file

@ -53,7 +53,7 @@ class MonitorWaitExecutor extends EventActionsExecutor {
public void run() { public void run() {
// wait when interrupted thread switches state to 'TIMED_WAITING' // wait when interrupted thread switches state to 'TIMED_WAITING'
while ((threadToInterrupt.getState() != Thread.State.WAITING) && !exitedFromWait) { while ((threadToInterrupt.getState() != Thread.State.WAITING) && !exitedFromWait) {
yield(); Thread.yield();
} }
// threadToInterrupt 'spuriously' exited from wait() // threadToInterrupt 'spuriously' exited from wait()
@ -236,7 +236,7 @@ class MonitorEnterExecutor extends EventActionsExecutor {
public void run() { public void run() {
// wait when blocked thread switches state to 'BLOCKED' // wait when blocked thread switches state to 'BLOCKED'
while (blockedThread.getState() != Thread.State.BLOCKED) while (blockedThread.getState() != Thread.State.BLOCKED)
yield(); Thread.yield();
lockingThread.releaseLock(); lockingThread.releaseLock();
} }

View file

@ -111,7 +111,7 @@ public class StateTestThread extends Thread {
start(); start();
while (!isRunning) while (!isRunning)
yield(); Thread.yield();
break; break;
case 2: case 2:
@ -119,7 +119,7 @@ public class StateTestThread extends Thread {
isRunning = false; isRunning = false;
while (this.getState() != Thread.State.TIMED_WAITING) while (this.getState() != Thread.State.TIMED_WAITING)
yield(); Thread.yield();
break; break;
case 3: case 3:
@ -129,7 +129,7 @@ public class StateTestThread extends Thread {
interrupt(); interrupt();
while (getState() != Thread.State.WAITING) while (getState() != Thread.State.WAITING)
yield(); Thread.yield();
break; break;
case 4: case 4:
@ -141,7 +141,7 @@ public class StateTestThread extends Thread {
} }
while (!readyToBeBlocked || (getState() != Thread.State.BLOCKED)) while (!readyToBeBlocked || (getState() != Thread.State.BLOCKED))
yield(); Thread.yield();
break; break;
case 5: case 5:

View file

@ -325,7 +325,7 @@ public class LockingThread extends Thread {
throw new TestBug("Locking thread can't reach required state (state: " + requiredState + " wasn't reached) in 1 minute"); throw new TestBug("Locking thread can't reach required state (state: " + requiredState + " wasn't reached) in 1 minute");
} }
yield(); Thread.yield();
} }
requiredState = null; requiredState = null;

View file

@ -78,7 +78,7 @@ public class MonitorLockingThread extends Thread {
* should already occur) and then force MonitorLockingThread to release lock * should already occur) and then force MonitorLockingThread to release lock
*/ */
while (blockedThread.getState() != Thread.State.BLOCKED) while (blockedThread.getState() != Thread.State.BLOCKED)
yield(); Thread.yield();
lockingThread.releaseLock(); lockingThread.releaseLock();
} }
@ -98,7 +98,7 @@ public class MonitorLockingThread extends Thread {
synchronized (lockToHold) { synchronized (lockToHold) {
holdsLock = true; holdsLock = true;
while (isRunning) while (isRunning)
yield(); Thread.yield();
} }
holdsLock = false; holdsLock = false;
} }
@ -106,12 +106,12 @@ public class MonitorLockingThread extends Thread {
public void releaseLock() { public void releaseLock() {
isRunning = false; isRunning = false;
while (holdsLock) while (holdsLock)
yield(); Thread.yield();
} }
public void acquireLock() { public void acquireLock() {
start(); start();
while (!holdsLock) while (!holdsLock)
yield(); Thread.yield();
} }
} }

View file

@ -81,7 +81,7 @@ public class ThreadsRunner implements MultiRunner, LogAware, RunParamsAware {
stresser.start(runParams.getIterations()); stresser.start(runParams.getIterations());
while (!this.isInterrupted() && stresser.iteration()) { while (!this.isInterrupted() && stresser.iteration()) {
test.run(); test.run();
yield(); Thread.yield();
} }
waitForOtherThreads(); waitForOtherThreads();
} catch (OutOfMemoryError oom) { } catch (OutOfMemoryError oom) {

View file

@ -84,7 +84,7 @@ class GarbageGenerator extends Thread {
while (!done) { while (!done) {
for (g = 0; g < ringSize; g++) { for (g = 0; g < ringSize; g++) {
gr.add(allocSize); gr.add(allocSize);
yield(); Thread.yield();
} }
gr.discard(); gr.discard();
try { try {

View file

@ -295,7 +295,7 @@ class strace001Thread extends Thread {
} }
if (strace001.DEPTH - currentDepth > 0) { if (strace001.DEPTH - currentDepth > 0) {
yield(); Thread.yield();
recursiveMethod(); recursiveMethod();
} }

View file

@ -304,7 +304,7 @@ class strace002Thread extends Thread {
} }
if (strace002.DEPTH - currentDepth > 0) { if (strace002.DEPTH - currentDepth > 0) {
yield(); Thread.yield();
recursiveMethod(); recursiveMethod();
} }

View file

@ -387,7 +387,7 @@ class strace005Thread extends Thread {
if (strace005.DEPTH - currentDepth > 0) { if (strace005.DEPTH - currentDepth > 0) {
try { try {
yield(); Thread.yield();
recursiveMethod2(); recursiveMethod2();
} catch (StackOverflowError e) { } catch (StackOverflowError e) {
// ignore this exception // ignore this exception

View file

@ -331,7 +331,7 @@ class strace006Thread extends Thread {
if (strace006.DEPTH - currentDepth > 0) { if (strace006.DEPTH - currentDepth > 0) {
try { try {
yield(); Thread.yield();
recursiveMethod2(); recursiveMethod2();
} catch (StackOverflowError e) { } catch (StackOverflowError e) {
// ignore this exception // ignore this exception

View file

@ -160,7 +160,7 @@ public class thread005 extends Thread {
*/ */
public void run() { public void run() {
while (!GO && !timeout()) while (!GO && !timeout())
yield(); Thread.yield();
while (!STOP && !timeout()) while (!STOP && !timeout())
; ;
} }

View file

@ -176,7 +176,7 @@ public class thread006 extends Thread {
*/ */
public void run() { public void run() {
while (!GO && !timeout()) while (!GO && !timeout())
yield(); Thread.yield();
while (!STOP && !timeout()) while (!STOP && !timeout())
; ;
} }

View file

@ -64,7 +64,7 @@ class InvokeHangTarg extends Thread {
// This is called from the debugger via invokeMethod // This is called from the debugger via invokeMethod
public double invokeee() { public double invokeee() {
System.out.println("Debuggee: invokeee in thread "+Thread.currentThread().toString()); System.out.println("Debuggee: invokeee in thread "+Thread.currentThread().toString());
yield(); Thread.yield();
return longMethod(2); return longMethod(2);
} }
public double longMethod(int n) { public double longMethod(int n) {

View file

@ -71,7 +71,7 @@ class SimulResumerTarg extends Thread {
public void bkpt1(int i) { public void bkpt1(int i) {
synchronized(name1) { synchronized(name1) {
yield(); Thread.yield();
} }
} }
@ -85,7 +85,7 @@ class SimulResumerTarg extends Thread {
public void bkpt2(int i) { public void bkpt2(int i) {
synchronized(name2) { synchronized(name2) {
yield(); Thread.yield();
} }
} }

View file

@ -70,7 +70,7 @@ class TwoThreadsTarg extends Thread {
} }
public void bkpt1(int i) { public void bkpt1(int i) {
yield(); Thread.yield();
} }
public void run1() { public void run1() {
@ -82,7 +82,7 @@ class TwoThreadsTarg extends Thread {
} }
public void bkpt2(int i) { public void bkpt2(int i) {
yield(); Thread.yield();
} }
public void run2() { public void run2() {

View file

@ -197,7 +197,7 @@ public class MTGraphicsAccessTest {
while (!done) { while (!done) {
try { try {
testRunnable.run(); testRunnable.run();
yield(); Thread.yield();
} catch (Throwable t) { } catch (Throwable t) {
numexceptions++; numexceptions++;
t.printStackTrace(); t.printStackTrace();

View file

@ -107,7 +107,7 @@ public class TestThreadCpuTimeEvent {
} catch (BrokenBarrierException e) { } catch (BrokenBarrierException e) {
// Another thread has been interrupted - wait for us to be interrupted as well // Another thread has been interrupted - wait for us to be interrupted as well
while (!interrupted()) { while (!interrupted()) {
yield(); Thread.yield();
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
// Normal way of stopping the thread // Normal way of stopping the thread

View file

@ -4,7 +4,7 @@
* @summary The compiler was allowing void types in its parsing of conditional expressions. * @summary The compiler was allowing void types in its parsing of conditional expressions.
* @author tball * @author tball
* *
* @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ConditionalWithVoid.java * @compile/fail/ref=ConditionalWithVoid.out -XDrawDiagnostics ConditionalWithVoid.java
*/ */
public class ConditionalWithVoid { public class ConditionalWithVoid {
public void test(Object o, String s) { public void test(Object o, String s) {

View file

@ -2,6 +2,4 @@ ConditionalWithVoid.java:12:71: compiler.err.void.not.allowed.here
ConditionalWithVoid.java:14:53: compiler.err.void.not.allowed.here ConditionalWithVoid.java:14:53: compiler.err.void.not.allowed.here
ConditionalWithVoid.java:16:82: compiler.err.void.not.allowed.here ConditionalWithVoid.java:16:82: compiler.err.void.not.allowed.here
ConditionalWithVoid.java:18:64: compiler.err.void.not.allowed.here ConditionalWithVoid.java:18:64: compiler.err.void.not.allowed.here
- compiler.note.preview.filename: ConditionalWithVoid.java
- compiler.note.preview.recompile
4 errors 4 errors

View file

@ -116,6 +116,7 @@ compiler.warn.is.preview # difficult to produce r
compiler.warn.override.bridge compiler.warn.override.bridge
compiler.warn.position.overflow # CRTable: caused by files with long lines >= 1024 chars compiler.warn.position.overflow # CRTable: caused by files with long lines >= 1024 chars
compiler.warn.proc.type.already.exists # JavacFiler: just mentioned in TODO compiler.warn.proc.type.already.exists # JavacFiler: just mentioned in TODO
compiler.warn.restricted.type.not.allowed.preview # not produced by the compiler right now
compiler.warn.unchecked.assign # DEAD, replaced by compiler.misc.unchecked.assign compiler.warn.unchecked.assign # DEAD, replaced by compiler.misc.unchecked.assign
compiler.warn.unchecked.cast.to.type # DEAD, replaced by compiler.misc.unchecked.cast.to.type compiler.warn.unchecked.cast.to.type # DEAD, replaced by compiler.misc.unchecked.cast.to.type
compiler.warn.unexpected.archive.file # Paths: zip file with unknown extn compiler.warn.unexpected.archive.file # Paths: zip file with unknown extn

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.break.outside.switch.expression // key: compiler.err.break.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class BreakOutsideSwitchExpression { class BreakOutsideSwitchExpression {
int t(int i) { int t(int i) {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.continue.outside.switch.expression // key: compiler.err.continue.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class ContinueOutsideSwitchExpression { class ContinueOutsideSwitchExpression {
int t(int i) { int t(int i) {

View file

@ -22,7 +22,8 @@
*/ */
// key: compiler.warn.illegal.ref.to.restricted.type // key: compiler.warn.illegal.ref.to.restricted.type
// key: compiler.warn.restricted.type.not.allowed.preview // key: compiler.warn.restricted.type.not.allowed
// options: -Xlint:-options -source 13
class IllegalRefToVarType { class IllegalRefToVarType {
yield list() { return null; } yield list() { return null; }

View file

@ -24,9 +24,6 @@
// key: compiler.err.prob.found.req // key: compiler.err.prob.found.req
// key: compiler.misc.incompatible.type.in.switch.expression // key: compiler.misc.incompatible.type.in.switch.expression
// key: compiler.misc.inconvertible.types // key: compiler.misc.inconvertible.types
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class IncompatibleTypesInSwitchExpression { class IncompatibleTypesInSwitchExpression {

View file

@ -22,7 +22,6 @@
*/ */
// key: compiler.err.invalid.yield // key: compiler.err.invalid.yield
// options: --enable-preview --source ${jdk.version}
class BreakComplexValueNoSwitchExpressions { class BreakComplexValueNoSwitchExpressions {
void t() { void t() {

View file

@ -22,7 +22,7 @@
*/ */
// key: compiler.warn.invalid.yield // key: compiler.warn.invalid.yield
// options: --source ${jdk.version} // options: -Xlint:-options --source 13
class BreakComplexValueNoSwitchExpressions { class BreakComplexValueNoSwitchExpressions {
void t() { void t() {

View file

@ -22,8 +22,8 @@
*/ */
// key: compiler.misc.feature.multiple.case.labels // key: compiler.misc.feature.multiple.case.labels
// key: compiler.warn.preview.feature.use.plural // key: compiler.err.feature.not.supported.in.source.plural
// options: --enable-preview -source ${jdk.version} -Xlint:preview // options: -Xlint:-options -source 13
class MultipleCaseLabels { class MultipleCaseLabels {
void m(int i) { void m(int i) {

View file

@ -22,7 +22,6 @@
*/ */
// key: compiler.err.no.switch.expression // key: compiler.err.no.switch.expression
// options: --enable-preview --source ${jdk.version}
class BreakComplexValueNoSwitchExpressions { class BreakComplexValueNoSwitchExpressions {
void t() { void t() {

View file

@ -22,7 +22,6 @@
*/ */
// key: compiler.err.no.switch.expression.qualify // key: compiler.err.no.switch.expression.qualify
// options: --enable-preview --source ${jdk.version}
class BreakComplexValueNoSwitchExpressions { class BreakComplexValueNoSwitchExpressions {
void t() { void t() {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.not.exhaustive // key: compiler.err.not.exhaustive
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class NotExhaustive { class NotExhaustive {
int t(int i) { int t(int i) {

View file

@ -1,26 +0,0 @@
/*
* Copyright (c) 2016, 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.warn.restricted.type.not.allowed.preview
class yield { }

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.return.outside.switch.expression // key: compiler.err.return.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class ReturnOutsideSwitchExpression { class ReturnOutsideSwitchExpression {
int t(int i) { int t(int i) {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.rule.completes.normally // key: compiler.err.rule.completes.normally
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class RuleCompletesNormally { class RuleCompletesNormally {
public String convert(int i) { public String convert(int i) {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.switch.case.unexpected.statement // key: compiler.err.switch.case.unexpected.statement
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class ReturnOutsideSwitchExpression { class ReturnOutsideSwitchExpression {
void t(int i) { void t(int i) {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.switch.expression.completes.normally // key: compiler.err.switch.expression.completes.normally
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class SwitchExpressionCompletesNormally { class SwitchExpressionCompletesNormally {
public String convert(int i) { public String convert(int i) {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.switch.expression.empty // key: compiler.err.switch.expression.empty
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class BreakOutsideSwitchExpression { class BreakOutsideSwitchExpression {
String t(E e) { String t(E e) {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.switch.expression.no.result.expressions // key: compiler.err.switch.expression.no.result.expressions
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class SwitchExpressionCompletesNormally { class SwitchExpressionCompletesNormally {
public String convert(int i) { public String convert(int i) {

View file

@ -24,9 +24,6 @@
// key: compiler.err.prob.found.req // key: compiler.err.prob.found.req
// key: compiler.misc.incompatible.ret.type.in.lambda // key: compiler.misc.incompatible.ret.type.in.lambda
// key: compiler.misc.switch.expression.target.cant.be.void // key: compiler.misc.switch.expression.target.cant.be.void
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class SwitchExpressionTargetCantBeVoid { class SwitchExpressionTargetCantBeVoid {

View file

@ -22,8 +22,8 @@
*/ */
// key: compiler.misc.feature.switch.expressions // key: compiler.misc.feature.switch.expressions
// key: compiler.warn.preview.feature.use.plural // key: compiler.err.feature.not.supported.in.source.plural
// options: --enable-preview -source ${jdk.version} -Xlint:preview // options: -Xlint:-options -source 13
class SwitchExpressions { class SwitchExpressions {
int m(int i) { int m(int i) {

View file

@ -22,9 +22,6 @@
*/ */
// key: compiler.err.switch.mixing.case.types // key: compiler.err.switch.mixing.case.types
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// options: --enable-preview -source ${jdk.version}
class SwitchMixingCaseTypes { class SwitchMixingCaseTypes {

View file

@ -22,8 +22,8 @@
*/ */
// key: compiler.misc.feature.switch.rules // key: compiler.misc.feature.switch.rules
// key: compiler.warn.preview.feature.use.plural // key: compiler.err.feature.not.supported.in.source.plural
// options: --enable-preview -source ${jdk.version} -Xlint:preview // options: -Xlint:-options -source 13
class SwitchExpressions { class SwitchExpressions {
void m(int i) { void m(int i) {

View file

@ -76,9 +76,6 @@ public class ExpSwitchNestingTest extends JavacTemplateTestBase {
} }
} }
private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source",
Integer.toString(Runtime.version().feature())};
private void program(String... constructs) { private void program(String... constructs) {
String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }"; String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }";
for (String c : constructs) for (String c : constructs)
@ -88,7 +85,7 @@ public class ExpSwitchNestingTest extends JavacTemplateTestBase {
private void assertOK(String... constructs) { private void assertOK(String... constructs) {
reset(); reset();
addCompileOptions(PREVIEW_OPTIONS); addCompileOptions();
program(constructs); program(constructs);
try { try {
compile(); compile();
@ -101,7 +98,7 @@ public class ExpSwitchNestingTest extends JavacTemplateTestBase {
private void assertOKWithWarning(String warning, String... constructs) { private void assertOKWithWarning(String warning, String... constructs) {
reset(); reset();
addCompileOptions(PREVIEW_OPTIONS); addCompileOptions();
program(constructs); program(constructs);
try { try {
compile(); compile();
@ -114,7 +111,7 @@ public class ExpSwitchNestingTest extends JavacTemplateTestBase {
private void assertFail(String expectedDiag, String... constructs) { private void assertFail(String expectedDiag, String... constructs) {
reset(); reset();
addCompileOptions(PREVIEW_OPTIONS); addCompileOptions();
program(constructs); program(constructs);
try { try {
compile(); compile();

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8206986 * @bug 8206986
* @summary Adding switch expressions * @summary Adding switch expressions
* @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BadSwitchExpressionLambda.java * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics BadSwitchExpressionLambda.java
*/ */
class BadSwitchExpressionLambda { class BadSwitchExpressionLambda {

View file

@ -1,6 +1,4 @@
BadSwitchExpressionLambda.java:19:26: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.switch.expression.target.cant.be.void)) BadSwitchExpressionLambda.java:19:26: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.switch.expression.target.cant.be.void))
BadSwitchExpressionLambda.java:21:9: compiler.err.cant.apply.symbol: kindname.method, r, BadSwitchExpressionLambda.SAM, @11, kindname.class, BadSwitchExpressionLambda, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.switch.expression.target.cant.be.void))) BadSwitchExpressionLambda.java:21:9: compiler.err.cant.apply.symbol: kindname.method, r, BadSwitchExpressionLambda.SAM, @11, kindname.class, BadSwitchExpressionLambda, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.switch.expression.target.cant.be.void)))
BadSwitchExpressionLambda.java:22:16: compiler.err.prob.found.req: (compiler.misc.unexpected.ret.val) BadSwitchExpressionLambda.java:22:16: compiler.err.prob.found.req: (compiler.misc.unexpected.ret.val)
- compiler.note.preview.filename: BadSwitchExpressionLambda.java
- compiler.note.preview.recompile
3 errors 3 errors

View file

@ -1096,7 +1096,7 @@ public class JavacParserTest extends TestCase {
String expectedErrors = "Test.java:1:178: compiler.err.switch.case.unexpected.statement\n"; String expectedErrors = "Test.java:1:178: compiler.err.switch.case.unexpected.statement\n";
StringWriter out = new StringWriter(); StringWriter out = new StringWriter();
JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null, JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", SOURCE_VERSION), Arrays.asList("-XDrawDiagnostics"),
null, Arrays.asList(new MyFileObject(code))); null, Arrays.asList(new MyFileObject(code)));
CompilationUnitTree cut = ct.parse().iterator().next(); CompilationUnitTree cut = ct.parse().iterator().next();

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Verify rule cases with expression statements and throw statements work. * @summary Verify rule cases with expression statements and throw statements work.
* @compile --enable-preview -source ${jdk.version} BlockExpression.java * @compile BlockExpression.java
* @run main/othervm --enable-preview BlockExpression * @run main BlockExpression
*/ */
public class BlockExpression { public class BlockExpression {

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8206986 * @bug 8206986
* @summary Verify the type of a conditional expression with nested switch expression is computed properly * @summary Verify the type of a conditional expression with nested switch expression is computed properly
* @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BooleanNumericNonNumeric.java * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics BooleanNumericNonNumeric.java
*/ */
public class BooleanNumericNonNumeric { public class BooleanNumericNonNumeric {

View file

@ -1,5 +1,3 @@
BooleanNumericNonNumeric.java:11:20: compiler.err.operator.cant.be.applied.1: +, int, boolean BooleanNumericNonNumeric.java:11:20: compiler.err.operator.cant.be.applied.1: +, int, boolean
BooleanNumericNonNumeric.java:19:15: compiler.err.cant.deref: int BooleanNumericNonNumeric.java:19:15: compiler.err.cant.deref: int
- compiler.note.preview.filename: BooleanNumericNonNumeric.java
- compiler.note.preview.recompile
2 errors 2 errors

View file

@ -67,7 +67,7 @@ public class BreakTest {
StringWriter out = new StringWriter(); StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors, JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null, List.of("-XDdev"), null,
Arrays.asList(new MyFileObject(CODE))); Arrays.asList(new MyFileObject(CODE)));
List<String> labels = new ArrayList<>(); List<String> labels = new ArrayList<>();
new TreePathScanner<Void, Void>() { new TreePathScanner<Void, Void>() {

View file

@ -151,9 +151,7 @@ public class CRT {
tb.createDirectories(classes); tb.createDirectories(classes);
tb.cleanDirectory(classes); tb.cleanDirectory(classes);
new JavacTask(tb) new JavacTask(tb)
.options("-Xjcov", .options("-Xjcov")
"--enable-preview",
"-source", SOURCE_VERSION)
.outdir(classes) .outdir(classes)
.sources("public class Test {\n" + .sources("public class Test {\n" +
code + code +

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8214031 8221413 * @bug 8214031 8221413
* @summary Verify that definite assignment when true works (legal code) * @summary Verify that definite assignment when true works (legal code)
* @compile --enable-preview --source ${jdk.version} DefiniteAssignment1.java * @compile DefiniteAssignment1.java
* @run main/othervm --enable-preview DefiniteAssignment1 * @run main DefiniteAssignment1
*/ */
public class DefiniteAssignment1 { public class DefiniteAssignment1 {
public static void main(String[] args) { public static void main(String[] args) {

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8214031 * @bug 8214031
* @summary Verify that definite assignment when true works (illegal code) * @summary Verify that definite assignment when true works (illegal code)
* @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source ${jdk.version} -XDrawDiagnostics DefiniteAssignment2.java * @compile/fail/ref=DefiniteAssignment2.out -XDrawDiagnostics DefiniteAssignment2.java
*/ */
public class DefiniteAssignment2 { public class DefiniteAssignment2 {

View file

@ -5,6 +5,4 @@ DefiniteAssignment2.java:49:19: compiler.err.var.might.not.have.been.initialized
DefiniteAssignment2.java:59:19: compiler.err.var.might.not.have.been.initialized: x DefiniteAssignment2.java:59:19: compiler.err.var.might.not.have.been.initialized: x
DefiniteAssignment2.java:69:19: compiler.err.var.might.not.have.been.initialized: x DefiniteAssignment2.java:69:19: compiler.err.var.might.not.have.been.initialized: x
DefiniteAssignment2.java:79:20: compiler.err.var.might.already.be.assigned: x DefiniteAssignment2.java:79:20: compiler.err.var.might.already.be.assigned: x
- compiler.note.preview.filename: DefiniteAssignment2.java
- compiler.note.preview.recompile
7 errors 7 errors

View file

@ -25,7 +25,7 @@
* @test * @test
* @bug 8206986 8226510 * @bug 8206986 8226510
* @summary Verify than a switch that does not yield a value is rejected. * @summary Verify than a switch that does not yield a value is rejected.
* @compile/fail/ref=EmptySwitch.out --enable-preview -source ${jdk.version} -XDrawDiagnostics -XDshould-stop.at=FLOW EmptySwitch.java * @compile/fail/ref=EmptySwitch.out -XDrawDiagnostics -XDshould-stop.at=FLOW EmptySwitch.java
*/ */
public class EmptySwitch { public class EmptySwitch {

View file

@ -3,6 +3,4 @@ EmptySwitch.java:35:10: compiler.err.switch.expression.no.result.expressions
EmptySwitch.java:38:10: compiler.err.switch.expression.no.result.expressions EmptySwitch.java:38:10: compiler.err.switch.expression.no.result.expressions
EmptySwitch.java:44:9: compiler.err.switch.expression.completes.normally EmptySwitch.java:44:9: compiler.err.switch.expression.completes.normally
EmptySwitch.java:47:26: compiler.err.rule.completes.normally EmptySwitch.java:47:26: compiler.err.rule.completes.normally
- compiler.note.preview.filename: EmptySwitch.java
- compiler.note.preview.recompile
5 errors 5 errors

View file

@ -25,9 +25,9 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Verify that an switch expression over enum can be exhaustive without default. * @summary Verify that an switch expression over enum can be exhaustive without default.
* @compile --enable-preview -source ${jdk.version} ExhaustiveEnumSwitch.java * @compile ExhaustiveEnumSwitch.java
* @compile ExhaustiveEnumSwitchExtra.java * @compile ExhaustiveEnumSwitchExtra.java
* @run main/othervm --enable-preview ExhaustiveEnumSwitch * @run main ExhaustiveEnumSwitch
*/ */
public class ExhaustiveEnumSwitch { public class ExhaustiveEnumSwitch {

View file

@ -1,4 +1,4 @@
ExpressionSwitch.java:40:16: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.expressions) ExpressionSwitch.java:40:16: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.expressions), 9, 14
ExpressionSwitch.java:41:20: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.switch.rules) ExpressionSwitch.java:41:20: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.switch.rules), 9, 14
ExpressionSwitch.java:93:31: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.multiple.case.labels) ExpressionSwitch.java:93:31: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.multiple.case.labels), 9, 14
3 errors 3 errors

View file

@ -3,8 +3,8 @@
* @bug 8206986 8222169 8224031 * @bug 8206986 8222169 8224031
* @summary Check expression switch works. * @summary Check expression switch works.
* @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java * @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java
* @compile --enable-preview -source ${jdk.version} ExpressionSwitch.java * @compile ExpressionSwitch.java
* @run main/othervm --enable-preview ExpressionSwitch * @run main ExpressionSwitch
*/ */
import java.util.Objects; import java.util.Objects;

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Verify behavior of various kinds of breaks. * @summary Verify behavior of various kinds of breaks.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchBreaks1.java * @compile ExpressionSwitchBreaks1.java
* @run main/othervm --enable-preview ExpressionSwitchBreaks1 * @run main ExpressionSwitchBreaks1
*/ */
import java.util.Objects; import java.util.Objects;

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8206986 * @bug 8206986
* @summary Check behavior for invalid breaks. * @summary Check behavior for invalid breaks.
* @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchBreaks2.java * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics ExpressionSwitchBreaks2.java
*/ */
public class ExpressionSwitchBreaks2 { public class ExpressionSwitchBreaks2 {

View file

@ -7,6 +7,4 @@ ExpressionSwitchBreaks2.java:40:17: compiler.err.no.switch.expression
ExpressionSwitchBreaks2.java:40:29: compiler.err.cant.resolve.location: kindname.variable, undef, , , (compiler.misc.location: kindname.class, ExpressionSwitchBreaks2, null) ExpressionSwitchBreaks2.java:40:29: compiler.err.cant.resolve.location: kindname.variable, undef, , , (compiler.misc.location: kindname.class, ExpressionSwitchBreaks2, null)
ExpressionSwitchBreaks2.java:45:22: compiler.err.break.outside.switch.expression ExpressionSwitchBreaks2.java:45:22: compiler.err.break.outside.switch.expression
ExpressionSwitchBreaks2.java:49:22: compiler.err.break.outside.switch.expression ExpressionSwitchBreaks2.java:49:22: compiler.err.break.outside.switch.expression
- compiler.note.preview.filename: ExpressionSwitchBreaks2.java
- compiler.note.preview.recompile
9 errors 9 errors

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 8214114 8214529 * @bug 8206986 8214114 8214529
* @summary Verify various corner cases with nested switch expressions. * @summary Verify various corner cases with nested switch expressions.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugs.java * @compile ExpressionSwitchBugs.java
* @run main/othervm --enable-preview ExpressionSwitchBugs * @run main ExpressionSwitchBugs
*/ */
public class ExpressionSwitchBugs { public class ExpressionSwitchBugs {

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8214031 * @bug 8214031
* @summary Verify various corner cases with nested switch expressions. * @summary Verify various corner cases with nested switch expressions.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugsInGen.java * @compile ExpressionSwitchBugsInGen.java
* @run main/othervm --enable-preview ExpressionSwitchBugsInGen * @run main ExpressionSwitchBugsInGen
*/ */
public class ExpressionSwitchBugsInGen { public class ExpressionSwitchBugsInGen {

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Check switch expressions * @summary Check switch expressions
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchCodeFromJLS.java * @compile ExpressionSwitchCodeFromJLS.java
* @run main/othervm --enable-preview ExpressionSwitchCodeFromJLS * @run main ExpressionSwitchCodeFromJLS
*/ */
public class ExpressionSwitchCodeFromJLS { public class ExpressionSwitchCodeFromJLS {

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Check definite (un)assignment for in switch expressions. * @summary Check definite (un)assignment for in switch expressions.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchDA.java * @compile ExpressionSwitchDA.java
* @run main/othervm --enable-preview ExpressionSwitchDA * @run main ExpressionSwitchDA
*/ */
public class ExpressionSwitchDA { public class ExpressionSwitchDA {

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8214031 8214114 * @bug 8214031 8214114
* @summary Verify switch expressions embedded in various statements work properly. * @summary Verify switch expressions embedded in various statements work properly.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchEmbedding.java * @compile ExpressionSwitchEmbedding.java
* @run main/othervm --enable-preview ExpressionSwitchEmbedding * @run main ExpressionSwitchEmbedding
*/ */
public class ExpressionSwitchEmbedding { public class ExpressionSwitchEmbedding {

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Check fall through in switch expressions. * @summary Check fall through in switch expressions.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough.java * @compile ExpressionSwitchFallThrough.java
* @run main/othervm --enable-preview ExpressionSwitchFallThrough * @run main ExpressionSwitchFallThrough
*/ */
import java.util.Objects; import java.util.Objects;

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Check fall through in switch expressions. * @summary Check fall through in switch expressions.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough1.java * @compile ExpressionSwitchFallThrough1.java
* @run main/othervm --enable-preview ExpressionSwitchFallThrough1 * @run main ExpressionSwitchFallThrough1
*/ */
import java.util.Objects; import java.util.Objects;

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8212982 * @bug 8212982
* @summary Verify a compile-time error is produced if switch expression does not provide a value * @summary Verify a compile-time error is produced if switch expression does not provide a value
* @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ExpressionSwitchFlow.java * @compile/fail/ref=ExpressionSwitchFlow.out -XDrawDiagnostics ExpressionSwitchFlow.java
*/ */
public class ExpressionSwitchFlow { public class ExpressionSwitchFlow {

View file

@ -7,6 +7,4 @@ ExpressionSwitchFlow.java:45:25: compiler.err.rule.completes.normally
ExpressionSwitchFlow.java:53:9: compiler.err.switch.expression.completes.normally ExpressionSwitchFlow.java:53:9: compiler.err.switch.expression.completes.normally
ExpressionSwitchFlow.java:61:9: compiler.err.switch.expression.completes.normally ExpressionSwitchFlow.java:61:9: compiler.err.switch.expression.completes.normally
ExpressionSwitchFlow.java:69:9: compiler.err.switch.expression.completes.normally ExpressionSwitchFlow.java:69:9: compiler.err.switch.expression.completes.normally
- compiler.note.preview.filename: ExpressionSwitchFlow.java
- compiler.note.preview.recompile
9 errors 9 errors

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Check switch expressions embedded in switch expressions. * @summary Check switch expressions embedded in switch expressions.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchInExpressionSwitch.java * @compile ExpressionSwitchInExpressionSwitch.java
* @run main/othervm --enable-preview ExpressionSwitchInExpressionSwitch * @run main ExpressionSwitchInExpressionSwitch
*/ */
public class ExpressionSwitchInExpressionSwitch { public class ExpressionSwitchInExpressionSwitch {

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8206986 * @bug 8206986
* @summary Check types inferred for switch expressions. * @summary Check types inferred for switch expressions.
* @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchInfer.java * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics ExpressionSwitchInfer.java
*/ */
import java.util.ArrayList; import java.util.ArrayList;

View file

@ -1,6 +1,4 @@
ExpressionSwitchInfer.java:17:95: compiler.err.cant.resolve.location.args: kindname.method, substring, , int, (compiler.misc.location: kindname.interface, java.lang.CharSequence, null) ExpressionSwitchInfer.java:17:95: compiler.err.cant.resolve.location.args: kindname.method, substring, , int, (compiler.misc.location: kindname.interface, java.lang.CharSequence, null)
ExpressionSwitchInfer.java:26:38: compiler.err.cant.resolve.location.args: kindname.method, substring, , int, (compiler.misc.location: kindname.interface, java.lang.CharSequence, null) ExpressionSwitchInfer.java:26:38: compiler.err.cant.resolve.location.args: kindname.method, substring, , int, (compiler.misc.location: kindname.interface, java.lang.CharSequence, null)
ExpressionSwitchInfer.java:30:23: compiler.err.prob.found.req: (compiler.misc.incompatible.type.in.switch.expression: (compiler.misc.inconvertible.types: int, java.lang.String)) ExpressionSwitchInfer.java:30:23: compiler.err.prob.found.req: (compiler.misc.incompatible.type.in.switch.expression: (compiler.misc.inconvertible.types: int, java.lang.String))
- compiler.note.preview.filename: ExpressionSwitchInfer.java
- compiler.note.preview.recompile
3 errors 3 errors

View file

@ -25,8 +25,8 @@
* @test * @test
* @bug 8206986 * @bug 8206986
* @summary Verify behavior when an intersection type is inferred for switch expression. * @summary Verify behavior when an intersection type is inferred for switch expression.
* @compile --enable-preview -source ${jdk.version} ExpressionSwitchIntersectionTypes.java * @compile ExpressionSwitchIntersectionTypes.java
* @run main/othervm --enable-preview ExpressionSwitchIntersectionTypes * @run main ExpressionSwitchIntersectionTypes
*/ */
public class ExpressionSwitchIntersectionTypes<X extends java.io.Serializable & Runnable> { public class ExpressionSwitchIntersectionTypes<X extends java.io.Serializable & Runnable> {

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8206986 * @bug 8206986
* @summary Verify behavior of not exhaustive switch expressions. * @summary Verify behavior of not exhaustive switch expressions.
* @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchNotExhaustive.java * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics ExpressionSwitchNotExhaustive.java
*/ */
public class ExpressionSwitchNotExhaustive { public class ExpressionSwitchNotExhaustive {

View file

@ -1,6 +1,4 @@
ExpressionSwitchNotExhaustive.java:10:16: compiler.err.not.exhaustive ExpressionSwitchNotExhaustive.java:10:16: compiler.err.not.exhaustive
ExpressionSwitchNotExhaustive.java:16:16: compiler.err.not.exhaustive ExpressionSwitchNotExhaustive.java:16:16: compiler.err.not.exhaustive
ExpressionSwitchNotExhaustive.java:29:23: compiler.err.var.might.not.have.been.initialized: s ExpressionSwitchNotExhaustive.java:29:23: compiler.err.var.might.not.have.been.initialized: s
- compiler.note.preview.filename: ExpressionSwitchNotExhaustive.java
- compiler.note.preview.recompile
3 errors 3 errors

View file

@ -99,7 +99,7 @@ public class ExpressionSwitchToString {
String sourceVersion = Integer.toString(Runtime.version().feature()); String sourceVersion = Integer.toString(Runtime.version().feature());
JavacTask ct = (JavacTask) tool.getTask(null, null, noErrors, JavacTask ct = (JavacTask) tool.getTask(null, null, noErrors,
List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null, List.of("-XDdev"), null,
Arrays.asList(new MyFileObject(CODE))); Arrays.asList(new MyFileObject(CODE)));
String actualCode = ct.parse().iterator().next().toString(); String actualCode = ct.parse().iterator().next().toString();
actualCode = actualCode.replace(System.getProperty("line.separator"), "\n"); actualCode = actualCode.replace(System.getProperty("line.separator"), "\n");

View file

@ -2,7 +2,7 @@
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8206986 * @bug 8206986
* @summary Verify reachability in switch expressions. * @summary Verify reachability in switch expressions.
* @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchUnreachable.java * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics ExpressionSwitchUnreachable.java
*/ */
public class ExpressionSwitchUnreachable { public class ExpressionSwitchUnreachable {

View file

@ -4,6 +4,4 @@ ExpressionSwitchUnreachable.java:30:17: compiler.err.unreachable.stmt
ExpressionSwitchUnreachable.java:37:17: compiler.err.unreachable.stmt ExpressionSwitchUnreachable.java:37:17: compiler.err.unreachable.stmt
ExpressionSwitchUnreachable.java:45:17: compiler.err.unreachable.stmt ExpressionSwitchUnreachable.java:45:17: compiler.err.unreachable.stmt
ExpressionSwitchUnreachable.java:52:17: compiler.err.unreachable.stmt ExpressionSwitchUnreachable.java:52:17: compiler.err.unreachable.stmt
- compiler.note.preview.filename: ExpressionSwitchUnreachable.java
- compiler.note.preview.recompile
6 errors 6 errors

View file

@ -26,7 +26,7 @@
* @bug 8220041 * @bug 8220041
* @summary Verify variable capture works inside switch expressions which are * @summary Verify variable capture works inside switch expressions which are
* inside variable declarations * inside variable declarations
* @compile --enable-preview -source ${jdk.version} LambdaCapture.java * @compile LambdaCapture.java
*/ */
import java.util.Objects; import java.util.Objects;

View file

@ -68,7 +68,7 @@ public class ParseIncomplete {
StringWriter out = new StringWriter(); StringWriter out = new StringWriter();
try { try {
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors, JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null, List.of("-XDdev"), null,
Arrays.asList(new MyFileObject(code))); Arrays.asList(new MyFileObject(code)));
ct.parse().iterator().next(); ct.parse().iterator().next();
} catch (Throwable t) { } catch (Throwable t) {

Some files were not shown because too many files have changed in this diff Show more