Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304878

ConcurrentModificationException in javadoc tool

    XMLWordPrintable

Details

    • 18
    • b26
    • generic
    • generic

    Backports

      Description

        ADDITIONAL SYSTEM INFORMATION :
        macOs 13.2.1 (aarch64), using Oracle OpenJDK versions 17.0.6, 19.0.2, and 20.

        A DESCRIPTION OF THE PROBLEM :
        The Javadoc tool can fail with a ConcurrentModificationException in certain cases. The trigger appears to be scanning package-info.java for deprecation annotations, but there are other criteria as well, which may explain why I'm unable to find a previous report of this issue.

        In the case where I encountered this error, the following all seem to be required to trigger the error:

        - a class A in one module extends a class B in another module
        - class B extends a class C in the same package
        - class C is not public, but has a public method
        - the package containing classes B and C has a package-info.java
        - the -nodeprecated flag is used

        This works without any problems in JDK 17, but subsequent releases all fail in the same way -- I have tested 18.0.2.1, 19.0.2, and 20.

        REGRESSION : Last worked in version 17.0.6

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a file structure as in the test case below, and run "javadoc --module-source-path src --module test.foo -nodeprecated".

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The command succeeds
        ACTUAL -
        The command fails, with output such as:

        Constructing Javadoc information...
        Building index for all the packages and classes...
        Standard Doclet version 20+36-2344
        Building tree for all the packages and classes...
        [...omitted some warnings caused by the test code not having any actual javadoc comments...]
        Generating ./overview-tree.html...
        error: An internal exception has occurred.
                (java.util.ConcurrentModificationException)
        Please file a bug against the javadoc tool via the Java bug reporting page
        (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com)
        for duplicates. Include error messages and the following diagnostic in your report. Thank you.
        java.util.ConcurrentModificationException
                at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1229)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getTreePath(Utils.java:2256)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getDocCommentInfo0(Utils.java:2339)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getDocCommentInfo(Utils.java:2317)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getDocCommentTree0(Utils.java:2285)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getDocCommentTree(Utils.java:2372)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getBlockTags(Utils.java:2159)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getBlockTags(Utils.java:2174)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getBlockTags(Utils.java:2186)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getDeprecatedTrees(Utils.java:2401)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.WorkArounds.isDeprecated0(WorkArounds.java:110)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.isDeprecated(Utils.java:1258)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder.shouldIndex(IndexBuilder.java:298)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder.indexMembers(IndexBuilder.java:241)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder.indexMembers(IndexBuilder.java:229)
                at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
                at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
                at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
                at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1921)
                at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
                at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
                at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
                at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
                at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
                at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder.addElements(IndexBuilder.java:146)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlIndexBuilder.addElements(HtmlIndexBuilder.java:81)
                at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generateOtherFiles(HtmlDoclet.java:268)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:213)
                at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:110)
                at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:103)
                at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:574)
                at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:397)
                at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:346)
                at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:57)
                at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:46)
        1 error
        4 warnings

        ---------- BEGIN SOURCE ----------
        #-- src/test.foo/module-info.java
        module test.foo {
            exports foo;
            requires test.bar;
        }

        #-- src/test.foo/foo/Foo.java
        package foo;

        import bar.Bar;

        public class Foo extends Bar {}

        #-- src/test.bar/module-info.java
        module test.bar {
            exports bar;
        }

        #-- src/test.bar/bar/package-info.java
        package bar;

        #-- src/test.bar/bar/Bar.java
        package bar;

        public abstract class Bar extends Base {}

        #-- src/test.bar/bar/Base.java
        package bar;

        abstract class Base {
            public int thing() {
                return 0;
            }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Do not upgrade past JDK 17, or make class C public.

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                prappo Pavel Rappo
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: