Skip to content

Commit

Permalink
8290901: Reduce use of -source in langtools tests
Browse files Browse the repository at this point in the history
Reviewed-by: jjg
  • Loading branch information
jddarcy committed Jul 29, 2022
1 parent 64a1a08 commit cc2861a
Show file tree
Hide file tree
Showing 81 changed files with 108 additions and 128 deletions.
@@ -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
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
@@ -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
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
@@ -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
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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
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
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
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
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
@@ -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
@@ -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
@@ -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
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
@@ -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
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
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
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
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
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
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
* @compile/ref=T6939780_7.out -Xlint:-options --release 7 T6939780.java -XDrawDiagnostics -XDfind=diamond
* @compile/ref=T6939780_8.out --release 8 T6939780.java -XDrawDiagnostics -XDfind=diamond
* @compile/ref=T6939780_9.out T6939780.java -XDrawDiagnostics -XDfind=diamond
*
*/

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/generics/diamond/neg/Neg09a.java
Expand Up @@ -4,8 +4,7 @@
*
* @summary Check that diamond is not allowed with anonymous inner class expressions at source < 9
* @author Maurizio Cimadamore
* @compile/fail/ref=Neg09a.out Neg09a.java -source 8 -XDrawDiagnostics -Xlint:-options
*
* @compile/fail/ref=Neg09a.out Neg09a.java --release 8 -XDrawDiagnostics
*/

class Neg09a {
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/generics/diamond/neg/Neg09a.out
@@ -1,2 +1,2 @@
Neg09a.java:15:34: compiler.err.cant.apply.diamond.1: Neg09a.Member<X>, (compiler.misc.feature.not.supported.in.source: (compiler.misc.feature.diamond.and.anon.class), 8, 9)
Neg09a.java:14:34: compiler.err.cant.apply.diamond.1: Neg09a.Member<X>, (compiler.misc.feature.not.supported.in.source: (compiler.misc.feature.diamond.and.anon.class), 8, 9)
1 error
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/generics/diamond/neg/Neg09b.java
Expand Up @@ -4,8 +4,7 @@
*
* @summary Check that diamond is not allowed with anonymous inner class expressions at source < 9
* @author Maurizio Cimadamore
* @compile/fail/ref=Neg09b.out Neg09b.java -source 8 -XDrawDiagnostics -Xlint:-options
*
* @compile/fail/ref=Neg09b.out Neg09b.java --release 8 -XDrawDiagnostics
*/

class Neg09b {
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/generics/diamond/neg/Neg09b.out
@@ -1,2 +1,2 @@
Neg09b.java:16:34: compiler.err.cant.apply.diamond.1: Neg09b.Nested<X>, (compiler.misc.feature.not.supported.in.source: (compiler.misc.feature.diamond.and.anon.class), 8, 9)
Neg09b.java:15:34: compiler.err.cant.apply.diamond.1: Neg09b.Nested<X>, (compiler.misc.feature.not.supported.in.source: (compiler.misc.feature.diamond.and.anon.class), 8, 9)
1 error
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/generics/diamond/neg/Neg09c.java
Expand Up @@ -4,8 +4,7 @@
*
* @summary Check that diamond is not allowed with anonymous inner class expressions at source < 9
* @author Maurizio Cimadamore
* @compile/fail/ref=Neg09c.out Neg09c.java -source 8 -XDrawDiagnostics -Xlint:-options
*
* @compile/fail/ref=Neg09c.out Neg09c.java --release 8 -XDrawDiagnostics
*/

class Neg09c {
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/generics/diamond/neg/Neg09c.out
@@ -1,2 +1,2 @@
Neg09c.java:15:39: compiler.err.cant.apply.diamond.1: Neg09c.Member<X>, (compiler.misc.feature.not.supported.in.source: (compiler.misc.feature.diamond.and.anon.class), 8, 9)
Neg09c.java:14:39: compiler.err.cant.apply.diamond.1: Neg09c.Member<X>, (compiler.misc.feature.not.supported.in.source: (compiler.misc.feature.diamond.and.anon.class), 8, 9)
1 error
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/generics/diamond/neg/Neg09d.java
Expand Up @@ -4,8 +4,7 @@
*
* @summary Check that diamond is not allowed with anonymous inner class expressions at source < 9
* @author Maurizio Cimadamore
* @compile/fail/ref=Neg09d.out Neg09d.java -source 8 -XDrawDiagnostics -Xlint:-options
*
* @compile/fail/ref=Neg09d.out Neg09d.java --release 8 -XDrawDiagnostics
*/

class Neg09d {
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/generics/diamond/neg/Neg09d.out
@@ -1,2 +1,2 @@
Neg09d.java:16:33: compiler.err.doesnt.exist: Neg09
Neg09d.java:15:33: compiler.err.doesnt.exist: Neg09
1 error
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/generics/diamond/neg/Neg10.java
Expand Up @@ -4,7 +4,7 @@
*
* @summary Check that 'complex' diamond can infer type that is too specific
* @author mcimadamore
* @compile/fail/ref=Neg10.out -source 7 -Xlint:-options Neg10.java -XDrawDiagnostics
* @compile/fail/ref=Neg10.out --release 7 -Xlint:-options Neg10.java -XDrawDiagnostics
* @compile Neg10.java -XDrawDiagnostics
*
*/
Expand Down
Expand Up @@ -3,7 +3,7 @@
* @bug 6278587 8007464
* @summary Inference broken for subtypes of subtypes of F-bounded types
* @author Peter von der Ah\u00e9
* @compile/fail/ref=T6278587Neg.out -XDrawDiagnostics -source 7 -Xlint:-options T6278587Neg.java
* @compile/fail/ref=T6278587Neg.out -XDrawDiagnostics --release 7 -Xlint:-options T6278587Neg.java
* @compile T6278587Neg.java
*/

Expand Down
Expand Up @@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 7154127 8007464
* @summary Inference cleanup: remove bound check analysis from visitors in Types.java
* @compile/fail/ref=T7154127.out -Xlint:-options -source 7 -XDrawDiagnostics T7154127.java
* @compile/fail/ref=T7154127.out -Xlint:-options --release 7 -XDrawDiagnostics T7154127.java
* @compile T7154127.java
*/
class T7154127 {
Expand Down
Expand Up @@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 7177306 8007464
* @summary Regression: unchecked method call does not erase return type
* @compile/fail/ref=T7177306e_7.out -XDrawDiagnostics -source 7 -Xlint:-options -XDrawDiagnostics T7177306e.java
* @compile/fail/ref=T7177306e_7.out -XDrawDiagnostics --release 7 -Xlint:-options -XDrawDiagnostics T7177306e.java
* @compile/fail/ref=T7177306e.out -XDrawDiagnostics T7177306e.java
*/

Expand Down

1 comment on commit cc2861a

@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.