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

Lambda back-end should generate invokespecial for method handles referring to private instance methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8, 8-repo-lambda
    • Fix Version/s: 8
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b84
    • Verification:
      Verified

      Description

      Example 2

      Source:

      public class InstanceLambda {

        public void m() {
          Runnable r = ()->m();
        }

      }

      ---

      javap of javac output (Lambda b76):

      Classfile /Users/dan/Dev/misc/classes/InstanceLambda.class
      ...
        BootstrapMethods:
          0: #16 invokestatic java/lang/invoke/LambdaMetafactory.metaFactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
            Method arguments:
              #17 invokeinterface java/lang/Runnable.run:()V
              #18 invokevirtual InstanceLambda.lambda$0:()V [***** Note invocation mode: invokevirtual *****]
              #19 ()V
      {
      ...
        public void m();
          flags: ACC_PUBLIC
          Code:
            stack=1, locals=2, args_size=1
               0: aload_0
               1: invokedynamic #2, 0 // InvokeDynamic #0:lambda$:(LInstanceLambda;)Ljava/lang/Runnable;
               6: astore_1
               7: return
      ...

        private void lambda$0();
          flags: ACC_PRIVATE, ACC_SYNTHETIC [***** Note access: private *****]
          Code:
            stack=1, locals=1, args_size=1
               0: aload_0
               1: invokevirtual #3 // Method m:()V
               4: return
      ...
      }

        Attachments

          Activity

            People

            Assignee:
            mcimadamore Maurizio Cimadamore
            Reporter:
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: