Skip to content
Permalink
Browse files
8235876: Misleading warning message in java source-file mode
Reviewed-by: vromero
  • Loading branch information
asotona committed Nov 24, 2021
1 parent 663e33d commit 951247c8cb4ea898bf7c188bed8e143ca7417c83
Showing 2 changed files with 16 additions and 1 deletion.
@@ -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;
}

@@ -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
@@ -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);

1 comment on commit 951247c

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 951247c Nov 24, 2021

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.