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

LambdaMetaFactory::metafactory on REF_invokeSpecial impl method has incorrect behavior

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 18
    • core-libs
    • None
    • behavioral
    • low
    • Java API
    • SE

      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.

            mchung Mandy Chung (Inactive)
            mchung Mandy Chung (Inactive)
            Paul Sandoz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: