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

Elements.overrides does not check overrider membership

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • 22
    • core-libs
    • None

    Description

      Elements.overrides does not check that the overrider method is a member of the class or interface from where that method presumably overrides the overridee.

      Although the intent is clear, the spec does not say what happens when a non-member is passed:

          @param type the class or interface of which the first method is a member

      An exception, the `false` result, or a note in the specification would seem to be in order. Consider this surprising result. Suppose:

          public class S { public void m() { } }
          public class T1 extends S { public void m() { } }
          public class T2 extends S { public void m() { } }

      Then (pseudocode):

          Elements.overrides(/* overrider */ T2::m, /* overridee */ S::m, /* from */ T3) == true

      Attachments

        Activity

          People

            darcy Joe Darcy
            prappo Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: