author | coleenp |
Fri, 31 Aug 2018 07:03:46 -0400 | |
changeset 51608 | 625a5bdde0c5 |
parent 48445 | cb7926b6b3d6 |
permissions | -rw-r--r-- |
48445
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
1 |
/* |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
4 |
* |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
8 |
* |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
13 |
* accompanied this code). |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
14 |
* |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
18 |
* |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
21 |
* questions. |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
22 |
*/ |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
23 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
24 |
/* |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
25 |
* @test |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
26 |
* @bug 8188649 |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
27 |
* @summary javadoc -encoding doesn't work when using the old doclet API |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
28 |
* @modules jdk.compiler/com.sun.tools.javac.api |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
29 |
* @modules jdk.compiler/com.sun.tools.javac.main |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
30 |
* @modules jdk.javadoc/jdk.javadoc.internal.api |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
31 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
32 |
* @library /tools/lib /tools/javadoc/lib |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
33 |
* @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox ToyDoclet |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
34 |
* @run main EncodingTest |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
35 |
*/ |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
36 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
37 |
import java.io.IOException; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
38 |
import java.nio.charset.StandardCharsets; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
39 |
import java.nio.file.Files; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
40 |
import java.nio.file.Path; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
41 |
import java.nio.file.Paths; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
42 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
43 |
import toolbox.JavadocTask; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
44 |
import toolbox.Task; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
45 |
import toolbox.TestRunner; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
46 |
import toolbox.ToolBox; |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
47 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
48 |
public class EncodingTest extends TestRunner { |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
49 |
public static void main(String... args) throws Exception { |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
50 |
EncodingTest t = new EncodingTest(); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
51 |
t.runTests(); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
52 |
} |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
53 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
54 |
private final ToolBox tb = new ToolBox(); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
55 |
private final Path src = Paths.get("src"); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
56 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
57 |
EncodingTest() throws Exception { |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
58 |
super(System.err); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
59 |
init(); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
60 |
} |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
61 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
62 |
void init() throws IOException { |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
63 |
Files.createDirectories(src); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
64 |
Files.write(src.resolve("C.java"), |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
65 |
"/** \u03b1\u03b2\u03b3 */ public class C { }".getBytes(StandardCharsets.UTF_8)); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
66 |
} |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
67 |
|
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
68 |
@Test |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
69 |
public void testEncoding() { |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
70 |
Task.Result result = new JavadocTask(tb, Task.Mode.EXEC) |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
71 |
.options("-docletpath", System.getProperty("test.class.path"), |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
72 |
"-doclet", "ToyDoclet", |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
73 |
"-J-Dfile.encoding=ASCII", |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
74 |
"-encoding", "UTF-8") |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
75 |
.files(src.resolve("C.java")) |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
76 |
.run(Task.Expect.SUCCESS) |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
77 |
.writeAll(); |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
78 |
} |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
79 |
} |
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
diff
changeset
|
80 |