langtools/test/jdk/javadoc/tool/BadOptionsTest.java
changeset 44020 ef5f709f4fd8
parent 42269 24a766b7c106
--- a/langtools/test/jdk/javadoc/tool/BadOptionsTest.java	Fri Feb 24 15:23:14 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/BadOptionsTest.java	Sat Feb 25 18:02:06 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8169676
+ * @bug 8169676 8175055
  * @summary boolean result of Option.process is often ignored
  * @modules jdk.compiler/com.sun.tools.javac.api
  * @modules jdk.compiler/com.sun.tools.javac.main
@@ -37,20 +37,6 @@
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Locale;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.lang.model.SourceVersion;
-
-import jdk.javadoc.doclet.Doclet;
-import jdk.javadoc.doclet.DocletEnvironment;
-import jdk.javadoc.doclet.Reporter;
 
 import toolbox.JavadocTask;
 import toolbox.ModuleBuilder;
@@ -146,6 +132,25 @@
         checkNotFound(result, "Exception", "at jdk.javadoc/");
     }
 
+    @Test
+    public void testSourcePathAndModuleSourceConflict() throws IOException {
+        Path msrc = Paths.get("msrc");
+        new ModuleBuilder(tb, "m1")
+                .exports("p1")
+                .classes("package p1; public class C1 { }")
+                .write(msrc);
+        Task.Result result = new JavadocTask(tb, Task.Mode.CMDLINE)
+                .options("-sourcepath", "src",
+                        "--module-source-path", msrc.getFileName().toString(),
+                        "--module", "m1")
+                .run(Task.Expect.FAIL)
+                .writeAll();
+        checkFound(result.getOutput(Task.OutputKind.DIRECT),
+                "javadoc: cannot specify both --source-path and --module-source-path");
+        checkFound(result.getOutput(Task.OutputKind.DIRECT),
+                "1 error");
+    }
+
     private void checkFound(String log, String... expect) {
         for (String e : expect) {
             if (!log.contains(e)) {