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

invokeinterface selects the static Object.registerNatives method

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: 7u45, 8
    • Fix Version/s: hs25
    • Component/s: hotspot
    • Labels:

      Description

      Selection of a method to invoke via invokeinterface involves a search for "an instance method with the same name and descriptor as the resolved method" (per JVMS). Yet this search is matching the private static method Object.registerNatives.

      Test:

      interface I { public void registerNatives(); }
      class C implements I {} // compiled separately
      class Test {
        public static void main(String... args) {
          I i = new C(); i.registerNatives();
        }
      }

      Expected: AME (or, if I.registerNatives is a default method, invoke that method)
      Actual: IAE (prior to JDK-8024804, a crash)

      This is related to JDK-8024804, but note that that bug is about _resolution_, not _selection_.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lfoltan Lois Foltan
                Reporter:
                dlsmith Dan Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: