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

Incorrect attribution of method invocations of Object methods on interfaces

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b18

      Description

      Consider code like:
      ---
      interface I {
           public String toString();
      }
      interface J extends I {}

      I i = null;
      i.toString(); //attributed as I.toString();
      J j = null;
      j.toString(); //attributed as j.toString();
      ---

      This does not seem quite right - the method is inherited in "J" from "I", not from Object.

      Moreover, calling `Elements.getAllMembers()` will return "toString" from "I" in the result, but calling `Trees.isAccessible(..., "toString", "I");` will return false, because it will appear that the method is implemented in j.l.Object.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jlahoda Jan Lahoda
              Reporter:
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: