1 /* |
1 /* |
2 * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 8169676 |
26 * @bug 8169676 8175055 |
27 * @summary boolean result of Option.process is often ignored |
27 * @summary boolean result of Option.process is often ignored |
28 * @modules jdk.compiler/com.sun.tools.javac.api |
28 * @modules jdk.compiler/com.sun.tools.javac.api |
29 * @modules jdk.compiler/com.sun.tools.javac.main |
29 * @modules jdk.compiler/com.sun.tools.javac.main |
30 * @modules jdk.javadoc/jdk.javadoc.internal.api |
30 * @modules jdk.javadoc/jdk.javadoc.internal.api |
31 * @modules jdk.javadoc/jdk.javadoc.internal.tool |
31 * @modules jdk.javadoc/jdk.javadoc.internal.tool |
35 */ |
35 */ |
36 |
36 |
37 import java.io.IOException; |
37 import java.io.IOException; |
38 import java.nio.file.Path; |
38 import java.nio.file.Path; |
39 import java.nio.file.Paths; |
39 import java.nio.file.Paths; |
40 import java.util.ArrayList; |
|
41 import java.util.Arrays; |
|
42 import java.util.HashSet; |
|
43 import java.util.List; |
|
44 import java.util.ListIterator; |
|
45 import java.util.Locale; |
|
46 import java.util.Objects; |
|
47 import java.util.Set; |
|
48 |
|
49 import javax.lang.model.SourceVersion; |
|
50 |
|
51 import jdk.javadoc.doclet.Doclet; |
|
52 import jdk.javadoc.doclet.DocletEnvironment; |
|
53 import jdk.javadoc.doclet.Reporter; |
|
54 |
40 |
55 import toolbox.JavadocTask; |
41 import toolbox.JavadocTask; |
56 import toolbox.ModuleBuilder; |
42 import toolbox.ModuleBuilder; |
57 import toolbox.Task; |
43 import toolbox.Task; |
58 import toolbox.TestRunner; |
44 import toolbox.TestRunner; |
144 checkFound(result.getOutput(Task.OutputKind.DIRECT), |
130 checkFound(result.getOutput(Task.OutputKind.DIRECT), |
145 "warning: bad name in value for --add-exports option: 'm!'"); |
131 "warning: bad name in value for --add-exports option: 'm!'"); |
146 checkNotFound(result, "Exception", "at jdk.javadoc/"); |
132 checkNotFound(result, "Exception", "at jdk.javadoc/"); |
147 } |
133 } |
148 |
134 |
|
135 @Test |
|
136 public void testSourcePathAndModuleSourceConflict() throws IOException { |
|
137 Path msrc = Paths.get("msrc"); |
|
138 new ModuleBuilder(tb, "m1") |
|
139 .exports("p1") |
|
140 .classes("package p1; public class C1 { }") |
|
141 .write(msrc); |
|
142 Task.Result result = new JavadocTask(tb, Task.Mode.CMDLINE) |
|
143 .options("-sourcepath", "src", |
|
144 "--module-source-path", msrc.getFileName().toString(), |
|
145 "--module", "m1") |
|
146 .run(Task.Expect.FAIL) |
|
147 .writeAll(); |
|
148 checkFound(result.getOutput(Task.OutputKind.DIRECT), |
|
149 "javadoc: cannot specify both --source-path and --module-source-path"); |
|
150 checkFound(result.getOutput(Task.OutputKind.DIRECT), |
|
151 "1 error"); |
|
152 } |
|
153 |
149 private void checkFound(String log, String... expect) { |
154 private void checkFound(String log, String... expect) { |
150 for (String e : expect) { |
155 for (String e : expect) { |
151 if (!log.contains(e)) { |
156 if (!log.contains(e)) { |
152 error("Expected string not found: '" + e + "'"); |
157 error("Expected string not found: '" + e + "'"); |
153 } |
158 } |