Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/tool/6176978/T6176978.java
40974 views
1
/*
2
* Copyright (c) 2008, 2015, 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 6176978
27
* @summary current Javadoc's invocation and extension (Doclet) mechanisms are problematic
28
* @modules jdk.javadoc
29
* @ignore no longer applicable, should delete
30
* @build T6176978
31
* @run main T6176978
32
*/
33
34
import java.io.*;
35
import java.net.*;
36
37
public class T6176978
38
{
39
public static void main(String[] args) throws Exception {
40
// create and use a temp dir that will not be on jtreg's
41
// default class path
42
File tmpDir = new File("tmp");
43
tmpDir.mkdirs();
44
45
File testSrc = new File(System.getProperty("test.src", "."));
46
String[] javac_args = {
47
"-d",
48
"tmp",
49
new File(testSrc, "X.java").getPath()
50
};
51
52
int rc = com.sun.tools.javac.Main.compile(javac_args);
53
if (rc != 0)
54
throw new Error("javac exit code: " + rc);
55
56
String[] jdoc_args = {
57
"-doclet",
58
"X",
59
new File(testSrc, "T6176978.java").getPath()
60
};
61
62
rc = jdk.javadoc.internal.tool.Main.execute(jdoc_args);
63
if (rc == 0)
64
throw new Error("javadoc unexpectedly succeeded");
65
66
67
68
Thread currThread = Thread.currentThread();
69
ClassLoader saveClassLoader = currThread.getContextClassLoader();
70
URLClassLoader urlCL = new URLClassLoader(new URL[] { tmpDir.toURL() });
71
currThread.setContextClassLoader(urlCL);
72
73
try {
74
rc = jdk.javadoc.internal.tool.Main.execute(jdoc_args);
75
if (rc != 0)
76
throw new Error("javadoc exit: " + rc);
77
} finally {
78
currThread.setContextClassLoader(saveClassLoader);
79
}
80
}
81
}
82
83