Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This project illustrates the problem where javac errors out when it attempts to display the dangling-doc-comment warning. The error only occurs if both lombok and manifold are in used, otherwise, the warning is displayed correctly.

Issues raised:

Reproduction Steps

Versions

JDK: 25.0.3 (Temurin) Maven: 3.9.16 Manifold and Lombok versions can be seen in pom.xml.

No Annotation Processor

Comment out both Manifold and Lombok annotation processor path and plugin compiler arg nodes. Run mvn clean compile and observe the warning being displayed correctly.

[INFO] --- compiler:3.11.0:compile (default-compile) @ dangling-doc ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 1 source file with javac [forked debug target 25] to target\classes
[WARNING] <path-to-repo>\dangling-doc-comment\src\main\java\com\example\App.java:[1] [dangling-doc-comments] documentation comment is not attached to any declaration

Only Manifold

Only comment out Lombok annotation processor path node. Run mvn clean compile and observe the warning still being displayed correctly as with no processor.

Only Lombok

Only comment out Manifold annotation processor path and plugin compiler arg nodes. Run mvn clean compile and observe the warning still being displayed correctly as with no processor.

With Both Manifold and Lombok

Leave both Manifold and Lombok declarations and run mvn clean compile. Observe the error below when javac attempts to display the warning.

[INFO] --- compiler:3.11.0:compile (default-compile) @ dangling-doc ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 1 source file with javac [forked debug target 25] to target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] An exception has occurred in the compiler (25.0.3). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because "this.deferred" is null
        at jdk.compiler/com.sun.tools.javac.util.Log$DeferredDiagnosticHandler.report(Log.java:157)
        at jdk.compiler/com.sun.tools.javac.util.Log.report(Log.java:683)
        at jdk.compiler/com.sun.tools.javac.util.AbstractLog.warning(AbstractLog.java:173)
        at jdk.compiler/com.sun.tools.javac.parser.JavacParser.lambda$reportDanglingDocComment$0(JavacParser.java:676)
        at jdk.compiler/com.sun.tools.javac.code.DeferredLintHandler.lambda$flush$0(DeferredLintHandler.java:174)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1716)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:803)
        at java.base/java.util.stream.ReferencePipeline$7$1FlatMap.accept(ReferencePipeline.java:293)
        at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:632)
        at jdk.compiler/com.sun.tools.javac.code.DeferredLintHandler.flush(DeferredLintHandler.java:174)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1002)
        at manifold.internal.javac.ManAttr_17.visitMethodDef(ManAttr_17.java:201)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:960)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5664)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5550)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
        at manifold.internal.javac.ManAttr_17.attribClass(ManAttr_17.java:824)
        at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5302)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1346)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:968)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
        at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
        at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)

Background

dangling-doc-comment Lint Warning

Java 23 added a javac lint warning to detect that a piece of javadoc is not properly attached to a class/interface or method which can result in the javadoc being missed out in javadoc generation.

See https://bugs.openjdk.org/browse/JDK-8329137 for more details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages