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

LambdaMetaFactory::metafactory on REF_invokeSpecial impl method has incorrect behavior

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      low
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      LambdaMetaFactory::metafactory on a REF_invokeSpecial implementation method should behave as if invokespecial instruction unless it's a private method in the caller class.

      Problem

      The integration of JEP 371 Hidden Classes (JDK-8238358) introduced a regression in JDK 15. The LambdaMetaFactory implementation was enhanced to generate hidden implementation classes that are nestmates (JEP 181: Nest-Based Access Control) of the caller, nest-host, class.

      Such nestmates class that invoke private methods on the nest host should use REF_invokeVirtual or REF_invokeInterface. However, the LambdaMetaFactory implementation incorrectly applied that to non-private (public, protected and package private) methods which should be invoked with REF_invokeSpecial.

      Solution

      Fix the implementation to convert REF_invokeSpecial to REF_invokeVirtual/REF_invokeInterface only if the implementation method is a private method of the caller class.

      Specification

      No specification change.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mchung Mandy Chung
              Reporter:
              mchung Mandy Chung
              Reviewed By:
              Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: