@@ -172,21 +172,21 @@ private DispatchTarget findDispatchTarget(TypedElement declaringType, MethodElem
172
172
*
173
173
* @param declaringType The declaring type
174
174
* @param methodElement The method element
175
- * @param interceptedProxyClassName The interceptedProxyClassName
176
- * @param interceptedProxyBridgeMethodName The interceptedProxyBridgeMethodName
175
+ * @param interceptedProxyType The interceptedProxyType
176
+ * @param interceptedProxyBridgeMethod The interceptedProxyBridgeMethod
177
177
* @return the target index
178
178
*/
179
179
public int addInterceptedMethod (TypedElement declaringType ,
180
180
MethodElement methodElement ,
181
- String interceptedProxyClassName ,
182
- String interceptedProxyBridgeMethodName ) {
181
+ ClassTypeDef interceptedProxyType ,
182
+ MethodDef interceptedProxyBridgeMethod ) {
183
183
hasInterceptedMethod = true ;
184
184
return addDispatchTarget (new InterceptableMethodDispatchTarget (
185
185
findDispatchTarget (declaringType , methodElement , false ),
186
186
declaringType ,
187
187
methodElement ,
188
- interceptedProxyClassName ,
189
- interceptedProxyBridgeMethodName )
188
+ interceptedProxyType ,
189
+ interceptedProxyBridgeMethod )
190
190
);
191
191
}
192
192
@@ -857,20 +857,20 @@ public ExpressionDef dispatchOneExpression(ExpressionDef target, ExpressionDef v
857
857
public static final class InterceptableMethodDispatchTarget extends AbstractDispatchTarget {
858
858
private final TypedElement declaringType ;
859
859
private final DispatchTarget dispatchTarget ;
860
- private final String interceptedProxyClassName ;
861
- private final String interceptedProxyBridgeMethodName ;
860
+ private final ClassTypeDef interceptedProxyType ;
861
+ private final MethodDef interceptedProxyBridgeMethod ;
862
862
private final MethodElement methodElement ;
863
863
864
864
private InterceptableMethodDispatchTarget (DispatchTarget dispatchTarget ,
865
865
TypedElement declaringType ,
866
866
MethodElement methodElement ,
867
- String interceptedProxyClassName ,
868
- String interceptedProxyBridgeMethodName ) {
867
+ ClassTypeDef interceptedProxyType ,
868
+ MethodDef interceptedProxyBridgeMethod ) {
869
869
this .declaringType = declaringType ;
870
870
this .methodElement = methodElement ;
871
871
this .dispatchTarget = dispatchTarget ;
872
- this .interceptedProxyClassName = interceptedProxyClassName ;
873
- this .interceptedProxyBridgeMethodName = interceptedProxyBridgeMethodName ;
872
+ this .interceptedProxyType = interceptedProxyType ;
873
+ this .interceptedProxyBridgeMethod = interceptedProxyBridgeMethod ;
874
874
}
875
875
876
876
@ Override
@@ -898,23 +898,21 @@ public StatementDef dispatch(ExpressionDef target, ExpressionDef valuesArray) {
898
898
VariableDef .Field interceptableField = new VariableDef .This ()
899
899
.field (FIELD_INTERCEPTABLE , TypeDef .of (boolean .class ));
900
900
901
- ClassTypeDef proxyType = ClassTypeDef .of (interceptedProxyClassName );
902
901
903
- return interceptableField .isTrue ().and (target .instanceOf (proxyType ))
902
+ return interceptableField .isTrue ().and (target .instanceOf (interceptedProxyType ))
904
903
.doIfElse (
905
- invokeProxyBridge (proxyType , target , valuesArray ),
904
+ invokeProxyBridge (interceptedProxyType , target , valuesArray ),
906
905
dispatchTarget .dispatch (target , valuesArray )
907
906
);
908
907
}
909
908
910
909
private StatementDef invokeProxyBridge (ClassTypeDef proxyType , ExpressionDef target , ExpressionDef valuesArray ) {
911
910
boolean suspend = methodElement .isSuspend ();
912
- ExpressionDef .InvokeInstanceMethod invoke = target .cast (proxyType ).invoke (
913
- interceptedProxyBridgeMethodName ,
914
- Arrays .stream (methodElement .getSuspendParameters ()).map (p -> TypeDef .of (p .getType ())).toList (),
915
- suspend ? TypeDef .OBJECT : TypeDef .of (methodElement .getReturnType ()),
916
- IntStream .range (0 , methodElement .getSuspendParameters ().length ).mapToObj (valuesArray ::arrayElement ).toList ()
917
- );
911
+ ExpressionDef .InvokeInstanceMethod invoke = target .cast (proxyType )
912
+ .invoke (
913
+ interceptedProxyBridgeMethod ,
914
+ IntStream .range (0 , methodElement .getSuspendParameters ().length ).mapToObj (valuesArray ::arrayElement ).toList ()
915
+ );
918
916
if (dispatchTarget .getMethodElement ().getReturnType ().isVoid () && !suspend ) {
919
917
return StatementDef .multi (
920
918
invoke ,
0 commit comments