-
Bug
-
Resolution: Unresolved
-
P4
-
21, 22, 23, 24
-
None
-
Tested on Mac M1, running with 15.1.1 (24B91) with OpenJDK 21, 22, 23 and EA builds for OpenJDK 24.
-
os_x
I tested the command `javadoc --allow-script-in-comments -d ./docs User.java` on the attached sample file. The output shows errors:
```
Loading source file User.java...
Constructing Javadoc information...
Building index for all the packages and classes...
Standard Doclet version 24-ea+27-3551
Building tree for all the packages and classes...
Generating ./docs/User.html...
User.java:15: error: malformed HTML
* if (monthDiff < 0 ||
^
User.java:16: error: bad HTML entity
* (monthDiff === 0 && today.getDate() > birthDate.getDate())) {
^
User.java:16: error: bad HTML entity
* (monthDiff === 0 && today.getDate() > birthDate.getDate())) {
^
```
This translates into malformed HTML output like:
```
<div class="block">The method calculates a driver's age and checks if they meet
the minimum age requirement.
<script>
function isEligible(birthDateString) {
const birthDate = new Date(birthDateString);
const today = new Date();
const age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (monthDiff <span class="invalid-tag">invalid input: '<'</span> 0 ||
(monthDiff === 0 <span class="invalid-tag">invalid input: '&'</span><span class="invalid-tag">invalid input: '&'</span> today.getDate() > birthDate.getDate())) {
return age - 1;
}
return age;
}
console.log(isEligible("1990-04-15"))
</script></div>
</section>
```
I tried the same with OpenJDK 21, 22, 23 and got the same results.
```
Loading source file User.java...
Constructing Javadoc information...
Building index for all the packages and classes...
Standard Doclet version 24-ea+27-3551
Building tree for all the packages and classes...
Generating ./docs/User.html...
User.java:15: error: malformed HTML
* if (monthDiff < 0 ||
^
User.java:16: error: bad HTML entity
* (monthDiff === 0 && today.getDate() > birthDate.getDate())) {
^
User.java:16: error: bad HTML entity
* (monthDiff === 0 && today.getDate() > birthDate.getDate())) {
^
```
This translates into malformed HTML output like:
```
<div class="block">The method calculates a driver's age and checks if they meet
the minimum age requirement.
<script>
function isEligible(birthDateString) {
const birthDate = new Date(birthDateString);
const today = new Date();
const age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (monthDiff <span class="invalid-tag">invalid input: '<'</span> 0 ||
(monthDiff === 0 <span class="invalid-tag">invalid input: '&'</span><span class="invalid-tag">invalid input: '&'</span> today.getDate() > birthDate.getDate())) {
return age - 1;
}
return age;
}
console.log(isEligible("1990-04-15"))
</script></div>
</section>
```
I tried the same with OpenJDK 21, 22, 23 and got the same results.