Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/tool/EncodingTest.java
40957 views
1
/*
2
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
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
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 8188649
27
* @summary ensure javadoc -encoding is not ignored
28
* @modules jdk.compiler/com.sun.tools.javac.api
29
* @modules jdk.compiler/com.sun.tools.javac.main
30
* @modules jdk.javadoc/jdk.javadoc.internal.api
31
* @modules jdk.javadoc/jdk.javadoc.internal.tool
32
* @library /tools/lib
33
* @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox
34
* @run main EncodingTest
35
*/
36
37
import java.io.IOException;
38
import java.nio.charset.StandardCharsets;
39
import java.nio.file.Files;
40
import java.nio.file.Path;
41
import java.nio.file.Paths;
42
43
import toolbox.JavadocTask;
44
import toolbox.Task;
45
import toolbox.TestRunner;
46
import toolbox.ToolBox;
47
48
public class EncodingTest extends TestRunner {
49
public static void main(String... args) throws Exception {
50
EncodingTest t = new EncodingTest();
51
t.runTests();
52
}
53
54
private final ToolBox tb = new ToolBox();
55
private final Path src = Paths.get("src");
56
private final Path api = Paths.get("api");
57
58
EncodingTest() throws Exception {
59
super(System.err);
60
init();
61
}
62
63
void init() throws IOException {
64
Files.createDirectories(src);
65
Files.write(src.resolve("C.java"),
66
"/** \u03b1\u03b2\u03b3 */ public class C { }".getBytes(StandardCharsets.UTF_8));
67
}
68
69
@Test
70
public void testEncoding() {
71
Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
72
.outdir(api)
73
.options("-J-Dfile.encoding=ASCII",
74
"-encoding", "UTF-8",
75
"-docencoding", "UTF-8")
76
.files(src.resolve("C.java"))
77
.run(Task.Expect.SUCCESS)
78
.writeAll();
79
}
80
}
81
82
83