Skip to content

Commit 4183d2d

Browse files
authored
IGNITE-28555 Fix javadoc compile on 17jdk (#13036)
1 parent cc8c95f commit 4183d2d

3 files changed

Lines changed: 32 additions & 33 deletions

File tree

modules/tools/src/main/java/org/apache/ignite/tools/ant/beautifier/GridJavadocAntTask.java

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,22 @@ private void processFile(String fileName) throws IOException {
154154
.configure(cfg -> cfg.setErrorLogEnabled(false))
155155
).parse(fileContent);
156156

157-
if (!"11".equals(System.getProperty("java.specification.version"))) {
158-
throw new IllegalArgumentException("GridJavadocAntTask isn't tested for java versions after 11. " +
159-
"Please check html rendering of documentation package groups works correctly and remove this exception then.");
157+
String javaVer = System.getProperty("java.specification.version");
158+
159+
boolean jdk11 = "11".equals(javaVer);
160+
boolean jdk17 = "17".equals(javaVer);
161+
162+
if (!jdk11 && !jdk17) {
163+
throw new IllegalArgumentException("GridJavadocAntTask is only tested for Java 11 and 17. " +
164+
"Current version: " + javaVer + ". " +
165+
"Please check html rendering of documentation package groups works correctly and add support then.");
160166
}
161167

162168
if ("index.html".equals(file.getName())) {
163169
// Try to find Other Packages section.
164-
Jerry otherPackages =
165-
doc.find("div.contentContainer table.overviewSummary caption span:contains('Other Packages')");
170+
Jerry otherPackages = jdk11
171+
? doc.find("div.contentContainer table.overviewSummary caption span:contains('Other Packages')")
172+
: doc.find("button.table-tab:contains('Other Packages')");
166173

167174
if (otherPackages.size() > 0) {
168175
System.err.println("[ERROR]: 'Other Packages' section should not be present, but found: " +
@@ -173,27 +180,34 @@ private void processFile(String fileName) throws IOException {
173180
"<configuration> / <groups>");
174181
}
175182

176-
int pkgGrps = doc.find("div.contentContainer table.overviewSummary caption span.tableTab").size();
183+
int pkgGrps = jdk11
184+
? doc.find("div.contentContainer table.overviewSummary caption span.tableTab").size()
185+
: doc.find("button.table-tab").size();
177186

178187
if (pkgGrps == 0) {
179188
throw new IllegalArgumentException("Documentation package groups missed. Please add packages " +
180189
"description to parent/pom.xml into <plugin>(maven-javadoc-plugin) / " +
181190
"<configuration> / <groups>");
182191
}
183192

184-
// This limit is set for JDK11. Each group is represented as a tab. Tabs are enumerated with a number 2^N
185-
// where N is a sequential number for a tab. For 32 tabs (+ the "All Packages" tab) the number is overflowed
186-
// and the tabulation becomes broken. See var data in "index.html".
187-
if (pkgGrps > 30) {
188-
throw new IllegalArgumentException("Too many package groups: " + pkgGrps + ". The limit"
189-
+ " is 30 due to the javadoc limitations. Please reduce groups in parent/pom.xml"
190-
+ " inside <plugin>(maven-javadoc-plugin) / <configuration> / <groups>");
193+
if (jdk11) {
194+
// This limit is set for JDK 11. Each group is represented as a tab. Tabs are enumerated with
195+
// a number 2^N where N is a sequential number for a tab. For 32 tabs (+ the "All Packages" tab)
196+
// the number is overflowed and the tabulation becomes broken. See var data in "index.html".
197+
// JDK 17 uses CSS class-based tab switching, so this limit does not apply.
198+
if (pkgGrps > 30) {
199+
throw new IllegalArgumentException("Too many package groups: " + pkgGrps + ". The limit"
200+
+ " is 30 due to the javadoc limitations. Please reduce groups in parent/pom.xml"
201+
+ " inside <plugin>(maven-javadoc-plugin) / <configuration> / <groups>");
202+
}
191203
}
192204
}
193205
else if (!isViewHtml(file)) {
194206
// TODO: fix the description block location IGNITE-22650
195207
// Try to find a class description block.
196-
Jerry descBlock = doc.find("div.contentContainer .description");
208+
Jerry descBlock = jdk11
209+
? doc.find("div.contentContainer .description")
210+
: doc.find("section.class-description");
197211

198212
if (descBlock.size() == 0)
199213
throw new IllegalArgumentException("Class doesn't have description in file: " + file);
@@ -204,6 +218,8 @@ else if (!isViewHtml(file)) {
204218
"</head>",
205219
"<link rel='shortcut icon' href='https://ignite.apache.org/favicon.ico'/>\n</head>\n");
206220

221+
s = s.replace("${current.year}", String.valueOf(java.time.Year.now().getValue()));
222+
207223
replaceFile(file, s);
208224
}
209225

parent/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
<xstream.version>1.4.17</xstream.version>
120120

121121
<!-- Maven plugins versions -->
122-
<maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
122+
<maven.javadoc.plugin.version>3.6.3</maven.javadoc.plugin.version>
123123
<maven.enforcer.plugin.version>3.6.2</maven.enforcer.plugin.version>
124124

125125
<sonar.organization>apache</sonar.organization>
@@ -702,6 +702,7 @@
702702
<name>ignite.buildNumber</name>
703703
<!-- See: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/SimpleDateFormat.html -->
704704
<pattern>yywwu</pattern>
705+
<locale>en_US</locale>
705706
</configuration>
706707
</execution>
707708
</executions>

pom.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,6 @@
112112
<id>javadoc</id>
113113
<build>
114114
<plugins>
115-
<plugin>
116-
<groupId>org.codehaus.mojo</groupId>
117-
<artifactId>build-helper-maven-plugin</artifactId>
118-
<version>3.0.0</version>
119-
<executions>
120-
<execution>
121-
<id>timestamp-property</id>
122-
<goals>
123-
<goal>timestamp-property</goal>
124-
</goals>
125-
<phase>validate</phase>
126-
<configuration>
127-
<name>current.year</name>
128-
<pattern>yyyy</pattern>
129-
</configuration>
130-
</execution>
131-
</executions>
132-
</plugin>
133115
<plugin>
134116
<groupId>org.apache.maven.plugins</groupId>
135117
<artifactId>maven-javadoc-plugin</artifactId>

0 commit comments

Comments
 (0)