author | ksrini |
Thu, 16 Mar 2017 18:50:50 -0700 | |
changeset 44301 | 2f97c71f06f4 |
child 44389 | a745e6ff79a5 |
permissions | -rw-r--r-- |
44301
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
1 |
/* |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
4 |
* |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
8 |
* |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
13 |
* accompanied this code). |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
14 |
* |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
18 |
* |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
21 |
* questions. |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
22 |
*/ |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
23 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
24 |
/** |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
25 |
* @test |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
26 |
* @bug 8175346 |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
27 |
* @summary Test patch module options |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
28 |
* @modules |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
29 |
* jdk.javadoc/jdk.javadoc.internal.api |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
30 |
* jdk.javadoc/jdk.javadoc.internal.tool |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.javac.api |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
32 |
* jdk.compiler/com.sun.tools.javac.main |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
33 |
* @library /tools/lib |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
34 |
* @build toolbox.ToolBox toolbox.TestRunner |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
35 |
* @run main PatchModules |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
36 |
*/ |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
37 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
38 |
import java.nio.file.Path; |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
39 |
import java.nio.file.Paths; |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
40 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
41 |
import toolbox.*; |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
42 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
43 |
public class PatchModules extends ModuleTestBase { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
44 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
45 |
public static void main(String... args) throws Exception { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
46 |
new PatchModules().runTests(); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
47 |
} |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
48 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
49 |
// Case A.1, m2 augmenting m1 |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
50 |
@Test |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
51 |
public void testPatchModuleOption(Path base) throws Exception { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
52 |
Path src = base.resolve("src"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
53 |
Path modulePath = base.resolve("modules"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
54 |
Path patchPath = base.resolve("patch"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
55 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
56 |
ModuleBuilder mb1 = new ModuleBuilder(tb, "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
57 |
mb1.comment("Module on module path.") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
58 |
.exports("pkg1") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
59 |
.classes("package pkg1; /** Class A */ public class A { }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
60 |
.build(modulePath); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
61 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
62 |
tb.writeJavaFiles(patchPath, "package pkg1; /** Class A */ public class A { public static int k; }"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
63 |
new JavacTask(tb) |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
64 |
.files(patchPath.resolve("pkg1/A.java")) |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
65 |
.run(); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
66 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
67 |
ModuleBuilder mb2 = new ModuleBuilder(tb, "m2"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
68 |
mb2.comment("The second module.") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
69 |
.exports("pkg2") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
70 |
.requires("m1") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
71 |
.classes("package pkg2; /** Class B */ public class B { /** Field f */ public int f = pkg1.A.k; }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
72 |
.write(src); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
73 |
execTask("--module-source-path", src.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
74 |
"--patch-module", "m1=" + patchPath.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
75 |
"--module-path", modulePath.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
76 |
"--module", "m2"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
77 |
checkModulesSpecified("m2"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
78 |
checkPackagesIncluded("pkg2"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
79 |
checkMembersSelected("pkg2.B.f"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
80 |
} |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
81 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
82 |
// Case A.2: use package, source form of m1 augmenting binary form of m1 |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
83 |
@Test |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
84 |
public void testPatchModuleWithPackage(Path base) throws Exception { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
85 |
Path modulePath = base.resolve("modules"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
86 |
Path moduleSrcPath = base.resolve("modulesSrc"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
87 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
88 |
Path mpath = Paths.get(moduleSrcPath.toString(), "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
89 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
90 |
ModuleBuilder mb1 = new ModuleBuilder(tb, "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
91 |
mb1.comment("Module m1.") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
92 |
.exports("pkg1") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
93 |
.classes("package pkg1; /** Class A */ public class A { }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
94 |
.classes("package pkg1.pkg2; /** Class B */ public class B { }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
95 |
.build(modulePath); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
96 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
97 |
execTask("-hasDocComments", |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
98 |
"--module-path", modulePath.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
99 |
"--add-modules", "m1", |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
100 |
"--patch-module", "m1=" + mpath.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
101 |
"pkg1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
102 |
checkTypesIncluded("pkg1.A hasDocComments"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
103 |
} |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
104 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
105 |
// Case A.2: use subpackages, source form of m1 augmenting binary form of m1 |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
106 |
@Test |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
107 |
public void testPatchModuleWithSubPackages(Path base) throws Exception { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
108 |
Path modulePath = base.resolve("modules"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
109 |
Path moduleSrcPath = base.resolve("modulesSrc"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
110 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
111 |
Path mpath = Paths.get(moduleSrcPath.toString(), "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
112 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
113 |
ModuleBuilder mb1 = new ModuleBuilder(tb, "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
114 |
mb1.comment("Module m1.") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
115 |
.exports("pkg1") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
116 |
.classes("package pkg1; /** Class A */ public class A { }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
117 |
.classes("package pkg1.pkg2; /** Class B */ public class B { }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
118 |
.build(modulePath); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
119 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
120 |
execTask("-hasDocComments", |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
121 |
"--module-path", modulePath.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
122 |
"--add-modules", "m1", |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
123 |
"--patch-module", "m1=" + mpath.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
124 |
"-subpackages", "pkg1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
125 |
checkTypesIncluded("pkg1.A hasDocComments"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
126 |
checkTypesIncluded("pkg1.pkg2.B hasDocComments"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
127 |
} |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
128 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
129 |
// Case B.1: (jsr166) augment and override system module |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
130 |
@Test |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
131 |
public void testPatchModuleModifyingSystemModule(Path base) throws Exception { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
132 |
Path src = base.resolve("src"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
133 |
Path patchSrc = base.resolve("patch"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
134 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
135 |
// build the patching sources |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
136 |
tb.writeJavaFiles(patchSrc, "package java.util;\n" + |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
137 |
"/** Class Collection */\n" + |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
138 |
"public interface Collection<K> {}"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
139 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
140 |
tb.writeJavaFiles(patchSrc, "package java.util;\n" |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
141 |
+ "/** Class MyCollection */\n" + |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
142 |
"public interface MyCollection<K> extends Collection {}"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
143 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
144 |
execTask("-hasDocComments", "--patch-module", "java.base=" + patchSrc.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
145 |
"java.util"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
146 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
147 |
checkPackagesSpecified("java.util"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
148 |
checkTypesIncluded("java.util.Collection hasDocComments", |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
149 |
"java.util.MyCollection hasDocComments"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
150 |
} |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
151 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
152 |
// Case C.1: patch a user module's sources using source path |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
153 |
@Test |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
154 |
public void testPatchModuleUsingSourcePath(Path base) throws Exception { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
155 |
Path src = base.resolve("src"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
156 |
Path patchSrc = base.resolve("patch"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
157 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
158 |
ModuleBuilder mb1 = new ModuleBuilder(tb, "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
159 |
mb1.comment("Module m1.") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
160 |
.exports("pkg1") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
161 |
.classes("package pkg1; /** Class A */ public class A { }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
162 |
.write(src); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
163 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
164 |
// build the patching module |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
165 |
tb.writeJavaFiles(patchSrc, "package pkg1;\n" + |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
166 |
"/** Class A */ public class A extends java.util.ArrayList { }"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
167 |
tb.writeJavaFiles(patchSrc, "package pkg1;\n" |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
168 |
+ "/** Class B */ public class B { }"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
169 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
170 |
Path m1src = Paths.get(src.toString(), "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
171 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
172 |
execTask("--source-path", m1src.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
173 |
"--patch-module", "m1=" + patchSrc.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
174 |
"pkg1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
175 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
176 |
checkPackagesSpecified("pkg1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
177 |
checkModulesIncluded("m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
178 |
checkTypesIncluded("pkg1.A", "pkg1.B"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
179 |
} |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
180 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
181 |
// Case C.2: patch a user module's sources using module source path |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
182 |
@Test |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
183 |
public void testPatchModuleWithModuleSourcePath(Path base) throws Exception { |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
184 |
Path src = base.resolve("src"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
185 |
Path patchSrc = base.resolve("patch"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
186 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
187 |
ModuleBuilder mb1 = new ModuleBuilder(tb, "m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
188 |
mb1.comment("Module on module-source-path.") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
189 |
.exports("pkg1") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
190 |
.classes("package pkg1; /** Class A */ public class A { }") |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
191 |
.write(src); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
192 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
193 |
// build the patching module |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
194 |
tb.writeJavaFiles(patchSrc, "package pkg1;\n" + |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
195 |
"/** Class A */ public class A extends java.util.ArrayList { }"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
196 |
tb.writeJavaFiles(patchSrc, "package pkg1;\n" |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
197 |
+ "/** Class B */ public class B { }"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
198 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
199 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
200 |
execTask("--module-source-path", src.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
201 |
"--add-modules", "m1", |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
202 |
"--patch-module", "m1=" + patchSrc.toString(), |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
203 |
"pkg1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
204 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
205 |
checkPackagesSpecified("pkg1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
206 |
checkModulesIncluded("m1"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
207 |
checkTypesIncluded("pkg1.A", "pkg1.B"); |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
208 |
} |
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
209 |
|
2f97c71f06f4
8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff
changeset
|
210 |
} |