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

Missing test for retroactive @SuppressWarnings("dangling-doc-comments") behavior

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 25
    • tools
    • jdk-25+18-43-g1d7138fe021

    • generic
    • generic

      After making some changes to the parser, I noticed that the build got broken due to a new "dangling-doc-comments" warning that was being reported - incorrectly, as it turns out, due to my changes. Yet all of the compiler regression tests were still passing.

      That indicates that some aspect of how "dangling-doc-comments" behaves is not being verified by the existing regression suite.

      That behavioral aspect is the "retroactive" nature of @SuppressWarnings("dangling-doc-comments"). That is, the warning suppression applies to comments preceding the declaration that the annotation annotates, even though those comments are not within the lexical scope of that declaration.

      For example:

           /** Dangling comment X */
          
           /** Proper comment Y */
           @SuppressWarnings("dangling-doc-comments")
           public void method() { }

      No warning is issued here because the @SuppressWarnings("dangling-doc-comments") applies retroactively to "Dangling comment X".

      This particular behavioral aspect should be included in the test suite.

            acobbs Archie Cobbs
            acobbs Archie Cobbs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: