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

Add lint category for dangling comments.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • tools
    • None

      Documentation comments will be ignored if they are not placed in an expected place, or if multiple comments are given in an expected place.

      It would be good to add a -Xlint category for "dangling doc comments"

      Suggested implementation:

      When any documentation comment is found, it can be recorded somewhere. When the comment is attached to a declaration, we can record that as well.
      Any difference between the two sets indicates dangling comments that have not been attached to a declaration.

      Since a source file is scanned top to bottom, it may be enough to use a one-element cache to record the most recent doc comment and whether it has been (or soon will be) attached to a comment. When the next doc comment is found, if the previous one has not been "claimed", then we can give a warning.

            Unassigned Unassigned
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: