Paul, Thank you for the explanations. Asking for your help in some test case construction at the end here:
>> 3. java/lang/invoke/package-info.java 128-134 >> Error handling could be clearer. >> My understanding is that if a LinkageError or subclass is thrown, this will >> be rethrown >> for all subsequent attempts. Other errors, e.g. VMError may retry resolution I was WRONG here - this does match the JVMS. Apologies for the confusion. >> >> 9. >> test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/InstructionHelper.java >> How would I write an ldc CONSTANT_Dynamic which referred to a bootstrap >> method that >> was not ACC_STATIC? > > https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.23 > <https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.23> > > See the note under bootstrap_method_ref. The kind of method handle is > constrained because of the arguments that are pushed on the stack before > invocation. I believe it’s possible to have a constructor, but the declaring > class would need to be a subtype of CallSite in the case of indy, and a > subtype of the constant value type in the case of condy. > > >> Or was not ACC_PUBLIC? > > That’s dependent on the accessibility between the lookup class the the BSM > declaring class. > > >> Or was >> Or did I read the invoke dynamic method incorrectly? >> > > By default, and for convenience, the InstructionHelper assumes the BSM is > declared by the lookup class. I recently modified that to support the BSM > being declared on another class, to test the minimal set of BSMs for condy > (separate issue [1]). Note it’s always possible to use the bytecode API more > directly. > > So we can easily add more -ve tests for non-accessible or non-static BSMs. Thank you - that is what we were trying to do - test BSM declared in another class, test in-accessible BSM and test non static method. Could you help us figure out how to 1) invoke a constructor? 2) invoke a virtual method? How do you pass the receiver? thanks, Karen > > Paul. > > [1] > http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8187742-condy-bootstraps/webrev/ > > <http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8187742-condy-bootstraps/webrev/>
