Skip to content

Commit

Permalink
8296968: Update langtools tests to use @enablePreview
Browse files Browse the repository at this point in the history
Reviewed-by: sundar, jjg
  • Loading branch information
jddarcy committed Nov 17, 2022
1 parent 2159170 commit e2269fd
Show file tree
Hide file tree
Showing 32 changed files with 113 additions and 120 deletions.
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/T8290379.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
* @test
* @bug 8290379
* @summary Parse error with parenthesized pattern and guard using an array
* @compile --enable-preview -source ${jdk.version} T8290379.java
* @run main/othervm --enable-preview T8290379
* @enablePreview
*/
public class T8290379 {
public static void main(String... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* @modules java.compiler
* jdk.jdeps/com.sun.tools.javap
* @build toolbox.JavapTask
* @compile --enable-preview -source ${jdk.version} Patterns.java
* @run main/othervm --enable-preview Patterns
* @enablePreview
* @run main Patterns
*/

import java.lang.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @test /nodynamiccopyright/
* @summary Verify error reports for erroneous deconstruction patterns are sensible
* @compile/fail/ref=DeconstructionPatternErrors.out --enable-preview -source ${jdk.version} -XDrawDiagnostics -XDshould-stop.at=FLOW -XDdev DeconstructionPatternErrors.java
* @enablePreview
* @compile/fail/ref=DeconstructionPatternErrors.out -XDrawDiagnostics -XDshould-stop.at=FLOW -XDdev DeconstructionPatternErrors.java
*/

import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
* jdk.compiler/com.sun.tools.javac.parser
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.util
* @compile --enable-preview -source ${jdk.version} DisambiguatePatterns.java
* @run main/othervm --enable-preview DisambiguatePatterns
* @enablePreview
*/

import com.sun.source.tree.CaseLabelTree;
Expand Down
4 changes: 2 additions & 2 deletions test/langtools/tools/javac/patterns/Domination.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
* @test
* @bug 8262891 8290709
* @summary Check the pattern domination error are reported correctly.
* @compile/fail/ref=Domination.out -XDrawDiagnostics --enable-preview -source ${jdk.version} Domination.java
* @enablePreview
* @compile/fail/ref=Domination.out -XDrawDiagnostics Domination.java
*/
public class Domination {

int testDominatesError1(Object o) {
switch (o) {
case CharSequence cs: return 0;
Expand Down
3 changes: 2 additions & 1 deletion test/langtools/tools/javac/patterns/EmptyRecordClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

/**
* @test
* @compile --enable-preview -source ${jdk.version} EmptyRecordClass.java
* @enablePreview
* @compile EmptyRecordClass.java
*/

public class EmptyRecordClass {
Expand Down
7 changes: 4 additions & 3 deletions test/langtools/tools/javac/patterns/EnumTypeChanges.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
* @test
* @bug 8262891
* @summary Verify pattern switches work properly when the set of enum constant changes.
* @compile --enable-preview -source ${jdk.version} EnumTypeChanges.java
* @compile --enable-preview -source ${jdk.version} EnumTypeChanges2.java
* @run main/othervm --enable-preview EnumTypeChanges
* @enablePreview
* @compile EnumTypeChanges.java
* @compile EnumTypeChanges2.java
* @run main EnumTypeChanges
*/

import java.util.function.Function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

/**
* @test
* @compile --enable-preview -source ${jdk.version} GenericRecordDeconstructionPattern.java
* @run main/othervm --enable-preview GenericRecordDeconstructionPattern
* @enablePreview
*/

import java.util.Objects;
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/patterns/Guards.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
* @test
* @bug 8262891 8268663 8289894
* @summary Check guards implementation.
* @compile --enable-preview -source ${jdk.version} Guards.java
* @run main/othervm --enable-preview Guards
* @enablePreview
*/

import java.util.Objects;
Expand Down
4 changes: 2 additions & 2 deletions test/langtools/tools/javac/patterns/GuardsErrors.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
* @test
* @bug 8262891
* @summary Check errors reported for guarded patterns.
* @compile/fail/ref=GuardsErrors.out -XDrawDiagnostics --enable-preview -source ${jdk.version} GuardsErrors.java
* @enablePreview
* @compile/fail/ref=GuardsErrors.out -XDrawDiagnostics GuardsErrors.java
*/

//TODO: tests and error recovery for misplaced guards

public class GuardsErrors {

void typeTestPatternSwitchTest(Object o, int check) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, 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
Expand All @@ -26,8 +26,7 @@
* @bug 8267610 8269738
* @summary LambdaToMethod cannot capture pattern variables. So the TransPatterns should
* transform the pattern variables and symbols to normal variables and symbols.
* @compile --enable-preview -source ${jdk.version} LambdaCannotCapturePatternVariables.java
* @run main/othervm --enable-preview LambdaCannotCapturePatternVariables
* @enablePreview
*/

import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

/**
* @test
* @compile --enable-preview -source ${jdk.version} NestedDeconstructionPattern.java
* @run main/othervm --enable-preview NestedDeconstructionPattern
* @enablePreview
*/

import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

/**
* @test
* @compile --enable-preview -source ${jdk.version} NestedPrimitiveDeconstructionPattern.java
* @run main/othervm --enable-preview NestedPrimitiveDeconstructionPattern
* @enablePreview
*/

import java.util.Objects;
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/patterns/NullSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8262891 8272776
* @summary Check null handling for non-pattern switches.
* @compile --enable-preview -source ${jdk.version} NullSwitch.java
* @run main/othervm --enable-preview NullSwitch
* @enablePreview
*/

public class NullSwitch {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
* @test /nodynamiccopyright/
* @summary Testing record patterns against the null constant (14.30.2 Pattern Matching)
* @compile --enable-preview -source ${jdk.version} NullsInDeconstructionPatterns.java
* @run main/othervm --enable-preview NullsInDeconstructionPatterns
* @enablePreview
*/

public class NullsInDeconstructionPatterns {
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/patterns/Parenthesized.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
* @test
* @bug 8262891 8269354
* @summary Test parenthesized pattern
* @compile --enable-preview -source ${jdk.version} Parenthesized.java
* @run main/othervm --enable-preview Parenthesized
* @enablePreview
*/
public class Parenthesized {
public static void main(String... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @test /nodynamiccopyright/
* @bug 8268859
* @summary Verify error recovery/disambiguation of case labels that mix expressions and patterns
* @compile/fail/ref=PatternCaseErrorRecovery.out --enable-preview -source ${jdk.version} -XDrawDiagnostics PatternCaseErrorRecovery.java
* @enablePreview
* @compile/fail/ref=PatternCaseErrorRecovery.out -XDrawDiagnostics PatternCaseErrorRecovery.java
*/

public class PatternCaseErrorRecovery {
Object expressionLikeType(Object o1, Object o2) {
final int a = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8268320
* @summary Verify user-friendly errors are reported for ill-formed pattern.
* @compile/fail/ref=PatternErrorRecovery.out -XDrawDiagnostics -XDshould-stop.at=FLOW --enable-preview -source ${jdk.version} PatternErrorRecovery.java
* @compile/fail/ref=PatternErrorRecovery.out -XDrawDiagnostics -XDshould-stop.at=FLOW --enable-preview -source ${jdk.version} PatternErrorRecovery.java
* @compile/fail/ref=PatternErrorRecovery-no-preview.out -XDrawDiagnostics -XDshould-stop.at=FLOW PatternErrorRecovery.java
*/
public class PatternErrorRecovery {
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/patterns/PrettyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
* @test
* @summary Test behavior of Pretty
* @modules jdk.compiler
* @compile --enable-preview -source ${jdk.version} PrettyTest.java
* @run main/othervm --enable-preview PrettyTest
* @enablePreview
*/

import java.io.IOException;
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/patterns/ProxyMethodLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
* @test
* @bug 8288120
* @summary Verify an appropriate accessor method is looked up.
* @compile --enable-preview -source ${jdk.version} ProxyMethodLookup.java
* @run main/othervm --enable-preview ProxyMethodLookup
* @enablePreview
*/
public class ProxyMethodLookup {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* @test /nodynamiccopyright/
* @bug 8263590
* @summary Verify correct warnings are produced for raw types in bindings
* @compile/ref=RawTypeBindingWarning.out -Xlint:rawtypes -XDrawDiagnostics --enable-preview -source ${jdk.version} RawTypeBindingWarning.java
* @enablePreview
* @compile/ref=RawTypeBindingWarning.out -Xlint:rawtypes -XDrawDiagnostics RawTypeBindingWarning.java
*/
public class RawTypeBindingWarning<T> {
public static boolean t(Object o) {
Expand Down
8 changes: 4 additions & 4 deletions test/langtools/tools/javac/patterns/RawTypeBindingWarning.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RawTypeBindingWarning.java:9:29: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
RawTypeBindingWarning.java:13:18: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
RawTypeBindingWarning.java:17:19: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
RawTypeBindingWarning.java:21:18: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
RawTypeBindingWarning.java:10:29: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
RawTypeBindingWarning.java:14:18: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
RawTypeBindingWarning.java:18:19: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
RawTypeBindingWarning.java:22:18: compiler.warn.raw.class.use: RawTypeBindingWarning, RawTypeBindingWarning<T>
- compiler.note.preview.filename: RawTypeBindingWarning.java, DEFAULT
- compiler.note.preview.recompile
4 warnings
8 changes: 4 additions & 4 deletions test/langtools/tools/javac/patterns/SealedTypeChanges.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
* @test
* @bug 8262891 8270151
* @summary Verify pattern switches work properly when the set of sealed types changes.
* @compile --enable-preview -source ${jdk.version} SealedTypeChanges.java
* @compile --enable-preview -source ${jdk.version} SealedTypeChanges2.java
* @run main/othervm --enable-preview SealedTypeChanges
* @enablePreview
* @compile SealedTypeChanges.java
* @compile SealedTypeChanges2.java
* @run main SealedTypeChanges
*/

import java.util.function.Consumer;

public class SealedTypeChanges {

public static void main(String... args) throws Exception {
new SealedTypeChanges().run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

/**
* @test
* @compile --enable-preview -source ${jdk.version} -doe SimpleAndGuardPattern.java
* @run main/othervm --enable-preview SimpleAndGuardPattern
* @enablePreview
* @compile -doe SimpleAndGuardPattern.java
* @run main SimpleAndGuardPattern
*/

import java.util.Objects;
Expand Down
3 changes: 2 additions & 1 deletion test/langtools/tools/javac/patterns/SwitchErrors.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* @test /nodynamiccopyright/
* @bug 8262891 8269146 8269113
* @summary Verify errors related to pattern switches.
* @compile/fail/ref=SwitchErrors.out --enable-preview -source ${jdk.version} -XDrawDiagnostics -XDshould-stop.at=FLOW SwitchErrors.java
* @enablePreview
* @compile/fail/ref=SwitchErrors.out -XDrawDiagnostics -XDshould-stop.at=FLOW SwitchErrors.java
*/
public class SwitchErrors {
void incompatibleSelectorObjectString(Object o) {
Expand Down

1 comment on commit e2269fd

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.