@@ -188,6 +188,10 @@ private Capture(int count, Class<?> type) {
188
188
* @param delegateMethodName The name of the method to be called in the Painless script class
189
189
* @param delegateMethodType The type of method call in the Painless script class without
190
190
* the captured types
191
+ * @param isDelegateInterface If the method to be called is owned by an interface where
192
+ * if the value is '1' if the delegate is an interface and '0'
193
+ * otherwise; note this is an int because the bootstrap method
194
+ * cannot convert constants to boolean
191
195
* @return A {@link CallSite} linked to a factory method for creating a lambda class
192
196
* that implements the expected functional interface
193
197
* @throws LambdaConversionException Thrown when an illegal type conversion occurs at link time
@@ -200,7 +204,8 @@ public static CallSite lambdaBootstrap(
200
204
String delegateClassName ,
201
205
int delegateInvokeType ,
202
206
String delegateMethodName ,
203
- MethodType delegateMethodType )
207
+ MethodType delegateMethodType ,
208
+ int isDelegateInterface )
204
209
throws LambdaConversionException {
205
210
Loader loader = (Loader )lookup .lookupClass ().getClassLoader ();
206
211
String lambdaClassName = Type .getInternalName (lookup .lookupClass ()) + "$$Lambda" + loader .newLambdaIdentifier ();
@@ -225,7 +230,7 @@ public static CallSite lambdaBootstrap(
225
230
226
231
generateInterfaceMethod (cw , factoryMethodType , lambdaClassType , interfaceMethodName ,
227
232
interfaceMethodType , delegateClassType , delegateInvokeType ,
228
- delegateMethodName , delegateMethodType , captures );
233
+ delegateMethodName , delegateMethodType , isDelegateInterface == 1 , captures );
229
234
230
235
endLambdaClass (cw );
231
236
@@ -369,6 +374,7 @@ private static void generateInterfaceMethod(
369
374
int delegateInvokeType ,
370
375
String delegateMethodName ,
371
376
MethodType delegateMethodType ,
377
+ boolean isDelegateInterface ,
372
378
Capture [] captures )
373
379
throws LambdaConversionException {
374
380
@@ -434,7 +440,7 @@ private static void generateInterfaceMethod(
434
440
Handle delegateHandle =
435
441
new Handle (delegateInvokeType , delegateClassType .getInternalName (),
436
442
delegateMethodName , delegateMethodType .toMethodDescriptorString (),
437
- delegateInvokeType == H_INVOKEINTERFACE );
443
+ isDelegateInterface );
438
444
iface .invokeDynamic (delegateMethodName , Type .getMethodType (interfaceMethodType
439
445
.toMethodDescriptorString ()).getDescriptor (), DELEGATE_BOOTSTRAP_HANDLE ,
440
446
delegateHandle );
0 commit comments