Skip to content

Commit

Permalink
8235876: Misleading warning message in java source-file mode
Browse files Browse the repository at this point in the history
Reviewed-by: vromero
  • Loading branch information
asotona committed Nov 24, 2021
1 parent 663e33d commit 951247c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -354,6 +354,7 @@ private List<String> getJavacOpts(String... runtimeArgs) throws Fault {
javacOpts.add("-Xdiags:verbose");
javacOpts.add("-Xlint:deprecation");
javacOpts.add("-Xlint:unchecked");
javacOpts.add("-Xlint:-options");
return javacOpts;
}

Expand Down
16 changes: 15 additions & 1 deletion test/langtools/tools/javac/launcher/SourceLauncherTest.java
Expand Up @@ -23,7 +23,7 @@

/*
* @test
* @bug 8192920 8204588 8246774 8248843 8268869
* @bug 8192920 8204588 8246774 8248843 8268869 8235876
* @summary Test source launcher
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
Expand Down Expand Up @@ -630,6 +630,20 @@ public void testNoRecompileWithSuggestions(Path base) throws IOException {
}
}

@Test
public void testNoOptionsWarnings(Path base) throws IOException {
tb.writeJavaFiles(base, "public class Main { public static void main(String... args) {}}");
String log = new JavaTask(tb)
.vmOptions("--source", "7")
.className(base.resolve("Main.java").toString())
.run(Task.Expect.SUCCESS)
.getOutput(Task.OutputKind.STDERR);

if (log.contains("warning: [options]")) {
error("Unexpected options warning in error output: " + log);
}
}

void testError(Path file, String expectStdErr, String expectFault) throws IOException {
Result r = run(file, Collections.emptyList(), List.of("1", "2", "3"));
checkEmpty("stdout", r.stdOut);
Expand Down

1 comment on commit 951247c

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