Skip to content

Commit

Permalink
8295176: some langtools test pollutes source tree
Browse files Browse the repository at this point in the history
Reviewed-by: sadayapalam, darcy, vromero
  • Loading branch information
lahodaj committed Oct 18, 2022
1 parent bca7ab3 commit 71aa821
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions test/langtools/tools/javac/options/release/ReleaseOption.java
@@ -1,9 +1,10 @@
/**
* @test /nodynamiccopyright/
* @bug 8072480
* @summary Verify that javac rejects Java 8 program with --release 7
* @summary Verify that javac rejects Java 17 program with --release 11
* @compile ReleaseOption.java
* @compile/fail/ref=ReleaseOption.out -XDrawDiagnostics --release 11 ReleaseOption.java
*/

interface ReleaseOption extends java.util.stream.Stream {
interface ReleaseOption extends java.util.random.RandomGenerator {
}
2 changes: 2 additions & 0 deletions test/langtools/tools/javac/options/release/ReleaseOption.out
@@ -0,0 +1,2 @@
ReleaseOption.java:9:49: compiler.err.doesnt.exist: java.util.random
1 error
Expand Up @@ -50,10 +50,12 @@ void run() throws IOException {
PrintWriter outWriter = new PrintWriter(out)) {
Iterable<? extends JavaFileObject> input =
fm.getJavaFileObjects(System.getProperty("test.src") + "/ReleaseOption.java");
List<String> options = Arrays.asList("--release", "8", "-XDrawDiagnostics", "-Xlint:-options");
List<String> options = Arrays.asList("--release", "11", "-XDrawDiagnostics", "-d", ".");

compiler.getTask(outWriter, fm, null, options, null, input).call();
String expected ="";
String expected =
"ReleaseOption.java:9:49: compiler.err.doesnt.exist: java.util.random" + lineSep +
"1 error" + lineSep;
if (!expected.equals(out.toString())) {
throw new AssertionError("Unexpected output: " + out.toString());
}
Expand Down

1 comment on commit 71aa821

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