JDK-8222091 : Javadoc does not handle package annotations correctly on package-info.java
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 12,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2019-03-20
  • Updated: 2022-11-30
  • Resolved: 2019-06-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.18Fixed 13 b24Fixed 14Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Tested on linux

A DESCRIPTION OF THE PROBLEM :
Package annotation on package-info.java is not properly processed

REGRESSION : Last worked in version 11

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See complete example on github

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Javadoc processing completed without problems. This works in java 11.
ACTUAL -
Javadoc is reporting two errors:

/home/cigaly/workspace/bug12/src/main/java/test/package-info.java:1: error: unknown tag: NamedQuery
@NamedQuery(name = "q1", query = "select something from somwhere where anything>1")
^
/home/cigaly/workspace/bug12/src/main/java/test/package-info.java:1: error: bad use of '>'
@NamedQuery(name = "q1", query = "select something from somwhere where anything>1")
                                                                               ^
2 errors

---------- BEGIN SOURCE ----------
Complete simplified example is on github at https://github.com/cigaly/bug12

package-info.java:

@NamedQuery(name = "q1", query = "select something from somwhere where anything>1")
package test;

import test.annotation.NamedQuery;

NamedQuery.java annotation:

package test.annotation;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({ TYPE, PACKAGE })
@Retention(RUNTIME)
public @interface NamedQuery {

    String name();

    String query();

}

---------- END SOURCE ----------

FREQUENCY : always



Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/1475 Date: 2022-10-25 17:06:11 +0000
25-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/1472 Date: 2022-10-24 19:09:04 +0000
24-10-2022

Fix Request 11u Backporting this patch fixes a regression in 11.0.17 caused by the backport of JDK-8193462, see: https://bugs.openjdk.org/browse/JDK-8295850
24-10-2022

URL: http://hg.openjdk.java.net/jdk/jdk/rev/7586561128e3 User: hannesw Date: 2019-06-04 14:21:19 +0000
04-06-2019

[~alanb] The problem is believed to be that javadoc is incorrectly reading "package-info.java" as though it were "package.html". It's then getting confused because the Java annotations in the file are being misconstrued as javadoc tags.
10-05-2019

Is there two issues here (NameQuery not found and ">" in the value string) or just one issue manifesting with two different errors? (easily duplicates for me btw)
01-05-2019

The issue is present in 12.0.1 on Debian/Ubnutu as well.
23-04-2019

The issue is restricted to Linux, though it works fine with Windows as well as Centos 7.3. However, it fails with reported error messages when checked with Ubuntu 18.10. Results (Ubuntu 18.10): =========== 8u202: OK 11.0.2: OK 12: Fail 13 ea b15: Fail This seems a regression in JDK 12. Output ======== $ ./gradlew clean build > Task :javadoc /home/user1/Downloads/bug12-master/src/main/java/test/package-info.java:1: error: unknown tag: NamedQuery @NamedQuery(name = "q1", query = "select something from somwhere where anything>1") ^ /home/user1/Downloads/bug12-master/src/main/java/test/package-info.java:1: error: bad use of '>' @NamedQuery(name = "q1", query = "select something from somwhere where anything>1") ^ 2 errors > Task :javadoc FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':javadoc'. > Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/home/user1/Downloads/bug12-master/build/tmp/javadoc/javadoc.options' * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 6s 4 actionable tasks: 4 executed
08-04-2019

Checked this for reported version JDK 11 as well as 12 and 13 with Gradle v 5.2.1 and the issue does not reproduce following information from https://github.com/cigaly/bug12. Output ========= ~\bug12>java -version openjdk version "12" 2019-03-19 OpenJDK Runtime Environment (build 12+33) OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing) ~\bug12>gradlew.bat clean build BUILD SUCCESSFUL in 4s 6 actionable tasks: 5 executed, 1 up-to-date Therefore writing back to the submitter with the results and asking them to recheck.
08-04-2019