Skip to content

Commit a5a034b

Browse files
committed
8257617: TestLinkPlatform fails with new Java source version
Reviewed-by: darcy
1 parent d80ae05 commit a5a034b

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

test/langtools/jdk/javadoc/doclet/testLinkPlatform/TestLinkPlatform.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* jdk.javadoc/jdk.javadoc.internal.tool
3131
* jdk.compiler/com.sun.tools.javac.api
3232
* jdk.compiler/com.sun.tools.javac.main
33-
* @build javadoc.tester.*
33+
* @build toolbox.ToolBox javadoc.tester.*
3434
* @run main TestLinkPlatform
3535
*/
3636

@@ -55,8 +55,8 @@ public class TestLinkPlatform extends JavadocTester {
5555
final static String NEW_PLATFORM_URL = "https://docs.oracle.com/en/java/javase/%d/docs/api/java.base/java/lang/Object.html";
5656
final static String PRE_PLATFORM_URL = "https://download.java.net/java/early_access/jdk%d/docs/api/java.base/java/lang/Object.html";
5757

58-
final static String NON_MODULAR_CUSTOM_PLATFORM_URL = "https://some.domain/docs/%d/api/java/lang/Object.html";
59-
final static String MODULAR_CUSTOM_PLATFORM_URL = "https://some.domain/docs/%d/api/java.base/java/lang/Object.html";
58+
final static String NON_MODULAR_CUSTOM_PLATFORM_URL = "https://example.com/%d/api/java/lang/Object.html";
59+
final static String MODULAR_CUSTOM_PLATFORM_URL = "https://example.com/%d/api/java.base/java/lang/Object.html";
6060

6161
final static int EARLIEST_VERSION = 7;
6262
final static int LATEST_VERSION = Integer.parseInt(SourceVersion.latest().name().substring(8));
@@ -113,13 +113,14 @@ private void testPlatformLinkWithSupportedVersions(Path base, String versionOpti
113113

114114
@Test
115115
public void testPlatformLinkWithCustomPropertyURL(Path base) throws Exception {
116+
Path customProps = writeCustomProperties(base);
116117
for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) {
117118
Path out = base.resolve("out_" + version);
118119

119120
javadoc("-d", out.toString(),
120121
"-sourcepath", packageSrc.toString(),
121122
"--release", Integer.toString(version),
122-
"--link-platform-properties", "file:" + testSrc("linkplatform.properties"),
123+
"--link-platform-properties", customProps.toUri().toString(),
123124
"p.q");
124125

125126
checkExit(Exit.OK);
@@ -134,13 +135,14 @@ public void testPlatformLinkWithCustomPropertyURL(Path base) throws Exception {
134135

135136
@Test
136137
public void testPlatformLinkWithCustomPropertyFile(Path base) throws Exception {
138+
Path customProps = writeCustomProperties(base);
137139
for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) {
138140
Path out = base.resolve("out_" + version);
139141

140142
javadoc("-d", out.toString(),
141143
"-sourcepath", packageSrc.toString(),
142144
"--release", Integer.toString(version),
143-
"--link-platform-properties", testSrc("linkplatform.properties"),
145+
"--link-platform-properties", customProps.toString(),
144146
"p.q");
145147

146148
checkExit(Exit.OK);
@@ -153,6 +155,17 @@ public void testPlatformLinkWithCustomPropertyFile(Path base) throws Exception {
153155
}
154156
}
155157

158+
private Path writeCustomProperties(Path base) throws IOException {
159+
ToolBox tb = new ToolBox();
160+
StringBuilder sb = new StringBuilder();
161+
for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) {
162+
sb.append(String.format("doclet.platform.docs.%1$d= https://example.com/%1$d/api/\n", version));
163+
}
164+
Path path = base.resolve("linkplatform.properties");
165+
tb.writeFile(path, sb.toString());
166+
return path;
167+
}
168+
156169
@Test
157170
public void testPlatformLinkWithInvalidPropertyFile(Path base) throws Exception {
158171
for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) {

test/langtools/jdk/javadoc/doclet/testLinkPlatform/linkplatform.properties

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)