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

@Override javadoc: address record components, their accessor methods, perhaps static methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • None
    • core-libs
    • None

      The current javadoc for java.lang.Override does not touch on these cases (discussing casually here, not proposing wording):

      * It can also appear on an explicit accessor method in a record class regardless of whether it overrides any supertype method (in this sense the current doc is clearly/actively wrong)
      * It is always valid on a record component declaration itself (and therefore expresses nothing).
      * If the method is declared in a record class, but the method is not an accessor method for a record component (it does have its usual non-record meaning in this case).
      * It's not usable for a static method to indicate that it hides another static method (to users these are very similar situations). (We may not *technically* have to mention this, but it seems helpful.)

      Beyond itemizing these, ideally we can concoct a new topic sentence that meets the standard of "not-incorrect-just-possibly-vague".

      We can also revise the javadoc to be more generally consistent with more-recent JLS rewordings.

      If the changes leave the doc slightly more future-proofed for when we come back and add `@Target({PATTERN_METHOD})` one day, even better, but not a priority.

      Of course, changing less than all the above at once is fine too.

            kbourril kevin bourrillion
            kbourril kevin bourrillion
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: