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

Private method check in linkResolver is incorrect

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
      11
    • Resolved In Build:
      b15
    • Verification:
      Verified

      Backports

        Description

        As discussed in JDK-8210768 this assertion in linkResolver has two problems:

          // For private method invocation we should only find the method in the resolved class.
          // If that is not the case then we have a found a supertype method that we have nestmate
          // access to.
          if (resolved_method->is_private() && resolved_method->method_holder() != resolved_klass) {
            ResourceMark rm(THREAD);
            DEBUG_ONLY(bool is_nestmate = InstanceKlass::cast(link_info.current_klass())->has_nestmate_access_to(InstanceKlass::cast(resolved_klass), THREAD);)
            assert(is_nestmate, "was only expecting nestmates to get here!");

        First the nestmate access check should be between the current class and the resolved_method->method_holder() not the resolved class.

        Second, we are only assured to have found a nestmate if normal access checking is enabled.

        But on further examination of this and a related test case the entire check regarding private methods is incorrect and needs to be removed as it violates the JVMS method resolution rules.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dholmes David Holmes
                Reporter:
                dholmes David Holmes
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: