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

Clarify that javax.lang.model.util.Elements.overrides is irreflexive

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 20
    • core-libs
    • None
    • behavioral
    • minimal
    • Document existing behavior.
    • Java API
    • SE

      Summary

      Clarify that the Elements.overrides relation is irreflexive, that is, a method does not override itself.

      Problem

      Users may have unnecessary difficulty using this method if they need to reason through whether or not the property holds or code as if the property did not hold.

      Solution

      Add the necessary spec clarification.

      Specification

      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java
      index f567c7f3b1b..c8849d6f612 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java
      @@ -622,6 +622,8 @@ public interface Elements {
            * overrides another method.
            * When a non-abstract method overrides an abstract one, the
            * former is also said to <i>implement</i> the latter.
      +     * As implied by JLS {@jls 8.4.8.1}, a method does <em>not</em>
      +     * override itself. The overrides relation is <i>irreflexive</i>.
            *
            * <p> In the simplest and most typical usage, the value of the
            * {@code type} parameter will simply be the class or interface

            darcy Joe Darcy
            prappo Pavel Rappo (Inactive)
            Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: