Skip to content

Commit

Permalink
8290901: Reduce use of -source in langtools tests
Browse files Browse the repository at this point in the history
Backport-of: cc2861a993c5c9926e4e9708d5b229c2a0072ca9
  • Loading branch information
GoeLin committed Mar 14, 2024
1 parent 807faa7 commit 7d716fc
Show file tree
Hide file tree
Showing 80 changed files with 106 additions and 126 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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 @@ -25,7 +25,7 @@
* @test
* @bug 8074306 8073432 8074501
* @summary NULLCHK is emitted as Object.getClass
* @compile -source 7 -target 7 TestSyntheticNullChecks.java
* @compile --release 7 TestSyntheticNullChecks.java
* @run main TestSyntheticNullChecks 7
* @clean *
* @compile TestSyntheticNullChecks.java
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/AnonStaticMember_1.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @summary Verify that an anonymous class can contain a static field only if source >= 16
* @author maddox
*
* @compile/fail/ref=AnonStaticMember_1.out -source 15 -XDrawDiagnostics AnonStaticMember_1.java
* @compile/fail/ref=AnonStaticMember_1.out --release 15 -XDrawDiagnostics AnonStaticMember_1.java
* @compile AnonStaticMember_1.java
*/

Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/AnonStaticMember_1.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- compiler.warn.source.no.system.modules.path: 15
AnonStaticMember_1.java:13:20: compiler.err.icls.cant.have.static.decl: compiler.misc.anonymous.class: AnonStaticMember_1$1
1 error
1 warning
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/AnonStaticMember_2.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @summary Verify that an anonymous class can contain a static method only if source >= 16
* @author maddox
*
* @compile/fail/ref=AnonStaticMember_2.out -source 15 -XDrawDiagnostics AnonStaticMember_2.java
* @compile/fail/ref=AnonStaticMember_2.out --release 15 -XDrawDiagnostics AnonStaticMember_2.java
* @compile AnonStaticMember_2.java
*/

Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/AnonStaticMember_2.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- compiler.warn.source.no.system.modules.path: 15
AnonStaticMember_2.java:13:21: compiler.err.icls.cant.have.static.decl: compiler.misc.anonymous.class: AnonStaticMember_2$1
1 error
1 warning
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/InnerNamedConstant_2.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @summary Verify rejection of illegal static variables in inner classes.
* @author William Maddox (maddox)
*
* @compile/fail/ref=InnerNamedConstant_2_A.out -XDrawDiagnostics -source 15 InnerNamedConstant_2.java
* @compile/fail/ref=InnerNamedConstant_2_A.out -XDrawDiagnostics --release 15 InnerNamedConstant_2.java
* @compile/fail/ref=InnerNamedConstant_2_B.out -XDrawDiagnostics InnerNamedConstant_2.java
*/

Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/InnerNamedConstant_2_A.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
- compiler.warn.source.no.system.modules.path: 15
InnerNamedConstant_2.java:23:20: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
InnerNamedConstant_2.java:24:29: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
InnerNamedConstant_2.java:26:13: compiler.err.cant.assign.val.to.final.var: z
InnerNamedConstant_2.java:35:26: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner3
4 errors
1 warning
4 changes: 2 additions & 2 deletions test/langtools/tools/javac/InterfaceInInner.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* @test /nodynamiccopyright/
* @bug 4063740 6969184
* @summary Interfaces can be declared in inner classes only for source >= 16
* @summary Interfaces can be declared in inner classes only for release >= 16
* @author turnidge
*
* @compile/fail/ref=InterfaceInInner.out -XDrawDiagnostics -source 15 InterfaceInInner.java
* @compile/fail/ref=InterfaceInInner.out -XDrawDiagnostics --release 15 InterfaceInInner.java
* @compile InterfaceInInner.java
*/
class InterfaceInInner {
Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/InterfaceInInner.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- compiler.warn.source.no.system.modules.path: 15
InterfaceInInner.java:13:13: compiler.err.icls.cant.have.static.decl: foo
1 error
1 warning
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/LocalInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8242478 8246774
* @summary test for local interfaces
* @compile/fail/ref=LocalInterface.out -XDrawDiagnostics -source 15 LocalInterface.java
* @compile/fail/ref=LocalInterface.out -XDrawDiagnostics --release 15 LocalInterface.java
* @compile LocalInterface.java
*/
class LocalInterface {
Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/LocalInterface.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- compiler.warn.source.no.system.modules.path: 15
LocalInterface.java:10:9: compiler.err.intf.not.allowed.here
1 error
1 warning
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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 Down Expand Up @@ -43,15 +43,15 @@
* @run main TestIndyStringConcat false
*
* @clean *
* @compile -XDstringConcat=inline -source 9 -target 9 TestIndyStringConcat.java
* @compile -XDstringConcat=inline TestIndyStringConcat.java
* @run main TestIndyStringConcat false
*
* @clean *
* @compile -XDstringConcat=indy -source 9 -target 9 TestIndyStringConcat.java
* @compile -XDstringConcat=indy TestIndyStringConcat.java
* @run main TestIndyStringConcat true
*
* @clean *
* @compile -XDstringConcat=indyWithConstants -source 9 -target 9 TestIndyStringConcat.java
* @compile -XDstringConcat=indyWithConstants TestIndyStringConcat.java
* @run main TestIndyStringConcat true
*/
public class TestIndyStringConcat {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @test /nodynamiccopyright/
* @bug 7196163
* @summary Verify that variables can be used as operands to try-with-resources
* @compile/fail/ref=TwrForVariable1.out -source 8 -XDrawDiagnostics -Xlint:-options TwrForVariable1.java
* @compile/fail/ref=TwrForVariable1.out --release 8 -XDrawDiagnostics TwrForVariable1.java
* @compile TwrForVariable1.java
* @run main TwrForVariable1
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* @test /nodynamiccopyright/
* @bug 8211102
* @summary Ensure that the lambda analyzer does not run when -source 7 is specified,
* @summary Ensure that the lambda analyzer does not run when --release 7 is specified,
* even if explicitly requested
* @compile/fail/ref=AnalyzersCheckSourceLevel.out -Werror -XDfind=lambda -XDrawDiagnostics AnalyzersCheckSourceLevel.java
* @compile -Werror -source 7 -Xlint:-options -XDfind=lambda AnalyzersCheckSourceLevel.java
* @compile -Werror --release 7 -Xlint:-options -XDfind=lambda AnalyzersCheckSourceLevel.java
*/
public class AnalyzersCheckSourceLevel {
void t() {
Expand Down
4 changes: 2 additions & 2 deletions test/langtools/tools/javac/analyzer/T8211102.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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 @@ -25,7 +25,7 @@
* @test
* @bug 8211102
* @summary Verify javac does not crash in lambda analyzer
* @compile -Werror -XDfind=lambda -source 7 -Xlint:-options T8211102.java
* @compile -Werror -XDfind=lambda --release 7 -Xlint:-options T8211102.java
*/
import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @bug 8138822
* @summary test that only Java 8+ allows repeating annotations
* @compile WrongVersion.java
* @compile -Xlint:-options -source 8 WrongVersion.java
* @compile --release 8 WrongVersion.java
* @compile/fail/ref=WrongVersion7.out -XDrawDiagnostics -Xlint:-options -source 7 WrongVersion.java
*/
import java.lang.annotation.Repeatable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @summary test that only Java 8 allows type annotations
* @author Mahmood Ali
* @compile AnnotationVersion.java
* @compile/fail/ref=AnnotationVersion7.out -XDrawDiagnostics -Xlint:-options -source 1.7 AnnotationVersion.java
* @compile/fail/ref=AnnotationVersion7.out -XDrawDiagnostics -Xlint:-options --release 7 AnnotationVersion.java
*/
import java.lang.annotation.*;

Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/conditional/Conditional.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @author Tim Hanson, BEA
*
* @compile Conditional.java
* @compile/fail/ref=Conditional.out -XDrawDiagnostics -source 7 -Xlint:-options Conditional.java
* @compile/fail/ref=Conditional.out -XDrawDiagnostics --release 7 -Xlint:-options Conditional.java
*/

import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @author gafter
*
* @compile/ref=SuppressDeprecation.out -Xlint:deprecation -XDrawDiagnostics SuppressDeprecation.java
* @compile/ref=SuppressDeprecation8.out -source 8 -Xlint:deprecation -XDrawDiagnostics -Xlint:-options SuppressDeprecation.java
* @compile/ref=SuppressDeprecation8.out --release 8 -Xlint:deprecation -XDrawDiagnostics SuppressDeprecation.java
*/

/* Test for the contexts in which deprecations warnings should
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/enum/LocalEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @bug 5019609 8246774
* @summary javac fails to reject local enums
* @author gafter
* @compile/fail/ref=LocalEnum.out -XDrawDiagnostics -source 15 LocalEnum.java
* @compile/fail/ref=LocalEnum.out -XDrawDiagnostics --release 15 LocalEnum.java
* @compile LocalEnum.java
*/

Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/enum/LocalEnum.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- compiler.warn.source.no.system.modules.path: 15
LocalEnum.java:12:9: compiler.err.local.enum
1 error
1 warning
4 changes: 2 additions & 2 deletions test/langtools/tools/javac/enum/NestedEnum.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* @test /nodynamiccopyright/
* @bug 5071831
* @summary javac allows enum in an inner class for source >= 16
* @summary javac allows enum in an inner class for release >= 16
* @author gafter
*
* @compile/fail/ref=NestedEnum.out -XDrawDiagnostics -source 15 NestedEnum.java
* @compile/fail/ref=NestedEnum.out -XDrawDiagnostics --release 15 NestedEnum.java
* @compile NestedEnum.java
*/

Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/enum/NestedEnum.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- compiler.warn.source.no.system.modules.path: 15
NestedEnum.java:13:9: compiler.err.static.declaration.not.allowed.in.inner.classes
1 error
1 warning
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/enum/T5081785.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @bug 5081785
* @summary enums should be allowed in non-static contexts
* @author Peter von der Ah\u00e9
* @compile/fail/ref=T5081785.out -XDrawDiagnostics -source 15 T5081785.java
* @compile/fail/ref=T5081785.out -XDrawDiagnostics --release 15 T5081785.java
* @compile T5081785.java
*/

Expand Down
2 changes: 0 additions & 2 deletions test/langtools/tools/javac/enum/T5081785.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
- compiler.warn.source.no.system.modules.path: 15
T5081785.java:30:9: compiler.err.static.declaration.not.allowed.in.inner.classes
T5081785.java:13:13: compiler.err.static.declaration.not.allowed.in.inner.classes
T5081785.java:20:27: compiler.err.static.declaration.not.allowed.in.inner.classes
T5081785.java:25:31: compiler.err.static.declaration.not.allowed.in.inner.classes
4 errors
1 warning
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/generics/6723444/T6723444.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @summary javac fails to substitute type variables into a constructor's throws clause
* @author Mark Mahieu
* @compile/fail/ref=T6723444_1.out -Xlint:-options -source 7 -XDrawDiagnostics T6723444.java
* @compile/fail/ref=T6723444_1.out -Xlint:-options --release 7 -XDrawDiagnostics T6723444.java
* @compile/fail/ref=T6723444_2.out -XDrawDiagnostics T6723444.java
*
*/
Expand Down
4 changes: 2 additions & 2 deletions test/langtools/tools/javac/generics/7015430/T7015430.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* @summary Incorrect thrown type determined for unchecked invocations
* @author Daniel Smith
* @compile/fail/ref=T7015430_1.out -source 7 -Xlint:-options,unchecked -XDrawDiagnostics T7015430.java
* @compile/fail/ref=T7015430_2.out -Xlint:unchecked -XDrawDiagnostics T7015430.java
* @compile/fail/ref=T7015430_1.out --release 7 -Xlint:-options,unchecked -XDrawDiagnostics T7015430.java
* @compile/fail/ref=T7015430_2.out -Xlint:unchecked -XDrawDiagnostics T7015430.java
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @bug 7022054
*
* @summary Invalid compiler error on covariant overriding methods with the same erasure
* @compile -source 7 T7022054pos1.java
* @compile --release 7 T7022054pos1.java
* @compile/fail/ref=T7022054pos1.out -XDrawDiagnostics T7022054pos1.java
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @bug 7022054
*
* @summary Invalid compiler error on covariant overriding methods with the same erasure
* @compile -source 7 T7022054pos2.java
* @compile --release 7 T7022054pos2.java
* @compile/fail/ref=T7022054pos2.out -XDrawDiagnostics T7022054pos2.java
*/

Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/generics/InstanceOf3.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @summary the type in an instanceof expression must be reifiable
* @author seligman
*
* @compile/fail/ref=InstanceOf3.out -XDrawDiagnostics -source 15 -Xlint:-options InstanceOf3.java
* @compile/fail/ref=InstanceOf3.out -XDrawDiagnostics --release 15 InstanceOf3.java
*/

public class InstanceOf3 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*
* @summary add a warning to detect diamond sites (including anonymous class instance creation at source >= 9)
* @author mcimadamore
* @compile/ref=T6939780_7.out -Xlint:-options -source 7 T6939780.java -XDrawDiagnostics -XDfind=diamond
* @compile/ref=T6939780_8.out -Xlint:-options -source 8 T6939780.java -XDrawDiagnostics -XDfind=diamond
* @compile/ref=T6939780_9.out -Xlint:-options -source 9 T6939780.java -XDrawDiagnostics -XDfind=diamond