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

Remapping a class with Invokedynamic constant loses static bootstrap arguments

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      Using the new internal Classfile API to rename a class that includes an Invokedynamic constant pool item, like LambdaMetafactory, does not copy the static bootstrap arguments.

      The issue seems to be in the class jdk/internal/classfile/components/ClassRemapper.java

      ClassRemapper is doing the following
      case InvokeDynamicInstruction idi ->
                              cob.invokeDynamicInstruction(DynamicCallSiteDesc.of(
                                      idi.bootstrapMethod(), idi.name().stringValue(),
                                      mapMethodDesc(idi.typeSymbol())));

      However, this way it ignores the bootstrap arguments. Probably it should be something like this:
      case InvokeDynamicInstruction idi ->
                              cob.invokeDynamicInstruction(DynamicCallSiteDesc.of(
                                      idi.bootstrapMethod(), idi.name().stringValue(),
                                      mapMethodDesc(idi.typeSymbol()),
                                      idi.bootstrapArgs().toArray(ConstantDesc[]::new));


      FREQUENCY : always


            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: