How to modify instructions in BootstrapMethods using ASM?

David Dunkle <[email protected]> Wed, 29 Nov 2017 12:54:48 -0800
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CAFhFTkt44BmAgKitzujROoNQ-AdWKi+4tC==2y8p89+mNUPJaA@mail.gmail.com>
After compiling with Java 8 and dumping the resulting class files with
javap, I see this, of which I am only showing the first 2 items:

BootstrapMethods:

  0: #174 invokestatic
java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;

    Method arguments:

      #175 (Ljava/lang/Object;)Z

      #179 invokestatic
llllll/lallll.lambda$printPersons$0:(Lllllll/lallll;)Z

      #180 (Lllllll/lallll;)Z

  1: #174 invokestatic
java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;

    Method arguments:

      #175 (Ljava/lang/Object;)Z

      #191 invokestatic
llllll/lallll.lambda$printPersons$1:(Lllllll/lallll;)Z

      #180 (Lllllll/lallll;)Z

  2: #174 invokestatic
java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/inv


Can I use ASM to visit the instructions in these bootstrap methods and
change, say, the names of the methods being called using invokestatic
instructions above?

Apparently these methods are not part of the normal methods of a class, and
I haven't had any luck visiting them using standard ASM class and method
techniques.

thanks,

-David


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws