@@ -185,7 +185,7 @@ static Method lookupMethodInternal(Definition definition, Class<?> receiverClass
185
185
Definition .MethodKey key = new Definition .MethodKey (name , arity );
186
186
// check whitelist for matching method
187
187
for (Class <?> clazz = receiverClass ; clazz != null ; clazz = clazz .getSuperclass ()) {
188
- Struct struct = definition .RuntimeClassToStruct (clazz );
188
+ Struct struct = definition .getPainlessStructFromJavaClass (clazz );
189
189
190
190
if (struct != null ) {
191
191
Method method = struct .methods .get (key );
@@ -195,7 +195,7 @@ static Method lookupMethodInternal(Definition definition, Class<?> receiverClass
195
195
}
196
196
197
197
for (Class <?> iface : clazz .getInterfaces ()) {
198
- struct = definition .RuntimeClassToStruct (iface );
198
+ struct = definition .getPainlessStructFromJavaClass (iface );
199
199
200
200
if (struct != null ) {
201
201
Method method = struct .methods .get (key );
@@ -279,7 +279,7 @@ static MethodHandle lookupMethod(Definition definition, Lookup lookup, MethodTyp
279
279
captures [capture ] = callSiteType .parameterType (i + 1 + capture );
280
280
}
281
281
MethodHandle filter ;
282
- Definition . Type interfaceType = definition . ClassToType ( method .arguments .get (i - 1 - replaced ) );
282
+ Class <?> interfaceType = method .arguments .get (i - 1 - replaced );
283
283
if (signature .charAt (0 ) == 'S' ) {
284
284
// the implementation is strongly typed, now that we know the interface type,
285
285
// we have everything.
@@ -293,14 +293,14 @@ static MethodHandle lookupMethod(Definition definition, Lookup lookup, MethodTyp
293
293
// the interface type is now known, but we need to get the implementation.
294
294
// this is dynamically based on the receiver type (and cached separately, underneath
295
295
// this cache). It won't blow up since we never nest here (just references)
296
- MethodType nestedType = MethodType .methodType (interfaceType . clazz , captures );
296
+ MethodType nestedType = MethodType .methodType (interfaceType , captures );
297
297
CallSite nested = DefBootstrap .bootstrap (definition ,
298
298
lookup ,
299
299
call ,
300
300
nestedType ,
301
301
0 ,
302
302
DefBootstrap .REFERENCE ,
303
- interfaceType . name );
303
+ Definition . ClassToName ( interfaceType ) );
304
304
filter = nested .dynamicInvoker ();
305
305
} else {
306
306
throw new AssertionError ();
@@ -324,8 +324,8 @@ static MethodHandle lookupMethod(Definition definition, Lookup lookup, MethodTyp
324
324
*/
325
325
static MethodHandle lookupReference (Definition definition , Lookup lookup , String interfaceClass ,
326
326
Class <?> receiverClass , String name ) throws Throwable {
327
- Definition . Type interfaceType = definition .getType (interfaceClass );
328
- Method interfaceMethod = interfaceType . struct .functionalMethod ;
327
+ Class <?> interfaceType = definition .getJavaClassFromPainlessType (interfaceClass );
328
+ Method interfaceMethod = definition . getPainlessStructFromJavaClass ( interfaceType ) .functionalMethod ;
329
329
if (interfaceMethod == null ) {
330
330
throw new IllegalArgumentException ("Class [" + interfaceClass + "] is not a functional interface" );
331
331
}
@@ -337,15 +337,15 @@ static MethodHandle lookupReference(Definition definition, Lookup lookup, String
337
337
338
338
/** Returns a method handle to an implementation of clazz, given method reference signature. */
339
339
private static MethodHandle lookupReferenceInternal (Definition definition , Lookup lookup ,
340
- Definition . Type clazz , String type , String call , Class <?>... captures )
340
+ Class <?> clazz , String type , String call , Class <?>... captures )
341
341
throws Throwable {
342
342
final FunctionRef ref ;
343
343
if ("this" .equals (type )) {
344
344
// user written method
345
- Method interfaceMethod = clazz . struct .functionalMethod ;
345
+ Method interfaceMethod = definition . getPainlessStructFromJavaClass ( clazz ) .functionalMethod ;
346
346
if (interfaceMethod == null ) {
347
347
throw new IllegalArgumentException ("Cannot convert function reference [" + type + "::" + call + "] " +
348
- "to [" + clazz . name + "], not a functional interface" );
348
+ "to [" + Definition . ClassToName ( clazz ) + "], not a functional interface" );
349
349
}
350
350
int arity = interfaceMethod .arguments .size () + captures .length ;
351
351
final MethodHandle handle ;
@@ -359,14 +359,14 @@ private static MethodHandle lookupReferenceInternal(Definition definition, Looku
359
359
// because the arity does not match the expected interface type.
360
360
if (call .contains ("$" )) {
361
361
throw new IllegalArgumentException ("Incorrect number of parameters for [" + interfaceMethod .name +
362
- "] in [" + clazz . clazz + "]" );
362
+ "] in [" + clazz + "]" );
363
363
}
364
364
throw new IllegalArgumentException ("Unknown call [" + call + "] with [" + arity + "] arguments." );
365
365
}
366
- ref = new FunctionRef (clazz . clazz , interfaceMethod , call , handle .type (), captures .length );
366
+ ref = new FunctionRef (clazz , interfaceMethod , call , handle .type (), captures .length );
367
367
} else {
368
368
// whitelist lookup
369
- ref = new FunctionRef (definition , clazz . clazz , type , call , captures .length );
369
+ ref = new FunctionRef (definition , clazz , type , call , captures .length );
370
370
}
371
371
final CallSite callSite = LambdaBootstrap .lambdaBootstrap (
372
372
lookup ,
@@ -379,7 +379,7 @@ private static MethodHandle lookupReferenceInternal(Definition definition, Looku
379
379
ref .delegateMethodType ,
380
380
ref .isDelegateInterface ? 1 : 0
381
381
);
382
- return callSite .dynamicInvoker ().asType (MethodType .methodType (clazz . clazz , captures ));
382
+ return callSite .dynamicInvoker ().asType (MethodType .methodType (clazz , captures ));
383
383
}
384
384
385
385
/** gets the field name used to lookup up the MethodHandle for a function. */
@@ -416,7 +416,7 @@ public static String getUserFunctionHandleFieldName(String name, int arity) {
416
416
static MethodHandle lookupGetter (Definition definition , Class <?> receiverClass , String name ) {
417
417
// first try whitelist
418
418
for (Class <?> clazz = receiverClass ; clazz != null ; clazz = clazz .getSuperclass ()) {
419
- Struct struct = definition .RuntimeClassToStruct (clazz );
419
+ Struct struct = definition .getPainlessStructFromJavaClass (clazz );
420
420
421
421
if (struct != null ) {
422
422
MethodHandle handle = struct .getters .get (name );
@@ -426,7 +426,7 @@ static MethodHandle lookupGetter(Definition definition, Class<?> receiverClass,
426
426
}
427
427
428
428
for (final Class <?> iface : clazz .getInterfaces ()) {
429
- struct = definition .RuntimeClassToStruct (iface );
429
+ struct = definition .getPainlessStructFromJavaClass (iface );
430
430
431
431
if (struct != null ) {
432
432
MethodHandle handle = struct .getters .get (name );
@@ -487,7 +487,7 @@ static MethodHandle lookupGetter(Definition definition, Class<?> receiverClass,
487
487
static MethodHandle lookupSetter (Definition definition , Class <?> receiverClass , String name ) {
488
488
// first try whitelist
489
489
for (Class <?> clazz = receiverClass ; clazz != null ; clazz = clazz .getSuperclass ()) {
490
- Struct struct = definition .RuntimeClassToStruct (clazz );
490
+ Struct struct = definition .getPainlessStructFromJavaClass (clazz );
491
491
492
492
if (struct != null ) {
493
493
MethodHandle handle = struct .setters .get (name );
@@ -497,7 +497,7 @@ static MethodHandle lookupSetter(Definition definition, Class<?> receiverClass,
497
497
}
498
498
499
499
for (final Class <?> iface : clazz .getInterfaces ()) {
500
- struct = definition .RuntimeClassToStruct (iface );
500
+ struct = definition .getPainlessStructFromJavaClass (iface );
501
501
502
502
if (struct != null ) {
503
503
MethodHandle handle = struct .setters .get (name );
0 commit comments