@@ -185,7 +185,7 @@ static Method lookupMethodInternal(Definition definition, Class<?> receiverClass
185185 Definition .MethodKey key = new Definition .MethodKey (name , arity );
186186 // check whitelist for matching method
187187 for (Class <?> clazz = receiverClass ; clazz != null ; clazz = clazz .getSuperclass ()) {
188- Struct struct = definition .RuntimeClassToStruct (clazz );
188+ Struct struct = definition .getPainlessStructFromJavaClass (clazz );
189189
190190 if (struct != null ) {
191191 Method method = struct .methods .get (key );
@@ -195,7 +195,7 @@ static Method lookupMethodInternal(Definition definition, Class<?> receiverClass
195195 }
196196
197197 for (Class <?> iface : clazz .getInterfaces ()) {
198- struct = definition .RuntimeClassToStruct (iface );
198+ struct = definition .getPainlessStructFromJavaClass (iface );
199199
200200 if (struct != null ) {
201201 Method method = struct .methods .get (key );
@@ -279,7 +279,7 @@ static MethodHandle lookupMethod(Definition definition, Lookup lookup, MethodTyp
279279 captures [capture ] = callSiteType .parameterType (i + 1 + capture );
280280 }
281281 MethodHandle filter ;
282- Definition . Type interfaceType = definition . ClassToType ( method .arguments .get (i - 1 - replaced ) );
282+ Class <?> interfaceType = method .arguments .get (i - 1 - replaced );
283283 if (signature .charAt (0 ) == 'S' ) {
284284 // the implementation is strongly typed, now that we know the interface type,
285285 // we have everything.
@@ -293,14 +293,14 @@ static MethodHandle lookupMethod(Definition definition, Lookup lookup, MethodTyp
293293 // the interface type is now known, but we need to get the implementation.
294294 // this is dynamically based on the receiver type (and cached separately, underneath
295295 // 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 );
297297 CallSite nested = DefBootstrap .bootstrap (definition ,
298298 lookup ,
299299 call ,
300300 nestedType ,
301301 0 ,
302302 DefBootstrap .REFERENCE ,
303- interfaceType . name );
303+ Definition . ClassToName ( interfaceType ) );
304304 filter = nested .dynamicInvoker ();
305305 } else {
306306 throw new AssertionError ();
@@ -324,8 +324,8 @@ static MethodHandle lookupMethod(Definition definition, Lookup lookup, MethodTyp
324324 */
325325 static MethodHandle lookupReference (Definition definition , Lookup lookup , String interfaceClass ,
326326 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 ;
329329 if (interfaceMethod == null ) {
330330 throw new IllegalArgumentException ("Class [" + interfaceClass + "] is not a functional interface" );
331331 }
@@ -337,15 +337,15 @@ static MethodHandle lookupReference(Definition definition, Lookup lookup, String
337337
338338 /** Returns a method handle to an implementation of clazz, given method reference signature. */
339339 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 )
341341 throws Throwable {
342342 final FunctionRef ref ;
343343 if ("this" .equals (type )) {
344344 // user written method
345- Method interfaceMethod = clazz . struct .functionalMethod ;
345+ Method interfaceMethod = definition . getPainlessStructFromJavaClass ( clazz ) .functionalMethod ;
346346 if (interfaceMethod == null ) {
347347 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" );
349349 }
350350 int arity = interfaceMethod .arguments .size () + captures .length ;
351351 final MethodHandle handle ;
@@ -359,14 +359,14 @@ private static MethodHandle lookupReferenceInternal(Definition definition, Looku
359359 // because the arity does not match the expected interface type.
360360 if (call .contains ("$" )) {
361361 throw new IllegalArgumentException ("Incorrect number of parameters for [" + interfaceMethod .name +
362- "] in [" + clazz . clazz + "]" );
362+ "] in [" + clazz + "]" );
363363 }
364364 throw new IllegalArgumentException ("Unknown call [" + call + "] with [" + arity + "] arguments." );
365365 }
366- ref = new FunctionRef (clazz . clazz , interfaceMethod , call , handle .type (), captures .length );
366+ ref = new FunctionRef (clazz , interfaceMethod , call , handle .type (), captures .length );
367367 } else {
368368 // whitelist lookup
369- ref = new FunctionRef (definition , clazz . clazz , type , call , captures .length );
369+ ref = new FunctionRef (definition , clazz , type , call , captures .length );
370370 }
371371 final CallSite callSite = LambdaBootstrap .lambdaBootstrap (
372372 lookup ,
@@ -379,7 +379,7 @@ private static MethodHandle lookupReferenceInternal(Definition definition, Looku
379379 ref .delegateMethodType ,
380380 ref .isDelegateInterface ? 1 : 0
381381 );
382- return callSite .dynamicInvoker ().asType (MethodType .methodType (clazz . clazz , captures ));
382+ return callSite .dynamicInvoker ().asType (MethodType .methodType (clazz , captures ));
383383 }
384384
385385 /** 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) {
416416 static MethodHandle lookupGetter (Definition definition , Class <?> receiverClass , String name ) {
417417 // first try whitelist
418418 for (Class <?> clazz = receiverClass ; clazz != null ; clazz = clazz .getSuperclass ()) {
419- Struct struct = definition .RuntimeClassToStruct (clazz );
419+ Struct struct = definition .getPainlessStructFromJavaClass (clazz );
420420
421421 if (struct != null ) {
422422 MethodHandle handle = struct .getters .get (name );
@@ -426,7 +426,7 @@ static MethodHandle lookupGetter(Definition definition, Class<?> receiverClass,
426426 }
427427
428428 for (final Class <?> iface : clazz .getInterfaces ()) {
429- struct = definition .RuntimeClassToStruct (iface );
429+ struct = definition .getPainlessStructFromJavaClass (iface );
430430
431431 if (struct != null ) {
432432 MethodHandle handle = struct .getters .get (name );
@@ -487,7 +487,7 @@ static MethodHandle lookupGetter(Definition definition, Class<?> receiverClass,
487487 static MethodHandle lookupSetter (Definition definition , Class <?> receiverClass , String name ) {
488488 // first try whitelist
489489 for (Class <?> clazz = receiverClass ; clazz != null ; clazz = clazz .getSuperclass ()) {
490- Struct struct = definition .RuntimeClassToStruct (clazz );
490+ Struct struct = definition .getPainlessStructFromJavaClass (clazz );
491491
492492 if (struct != null ) {
493493 MethodHandle handle = struct .setters .get (name );
@@ -497,7 +497,7 @@ static MethodHandle lookupSetter(Definition definition, Class<?> receiverClass,
497497 }
498498
499499 for (final Class <?> iface : clazz .getInterfaces ()) {
500- struct = definition .RuntimeClassToStruct (iface );
500+ struct = definition .getPainlessStructFromJavaClass (iface );
501501
502502 if (struct != null ) {
503503 MethodHandle handle = struct .setters .get (name );
0 commit comments