@@ -190,7 +190,8 @@ protected FieldDescriptor createConstructor(ClassOutput classOutput, BeanInfo be
190
190
Map <MethodDescriptor , MethodDescriptor > forwardingMethods = new HashMap <>();
191
191
List <MethodInfo > interceptedOrDecoratedMethods = bean .getInterceptedOrDecoratedMethods ();
192
192
for (MethodInfo method : interceptedOrDecoratedMethods ) {
193
- forwardingMethods .put (MethodDescriptor .of (method ), createForwardingMethod (subclass , providerTypeName , method ));
193
+ forwardingMethods .put (MethodDescriptor .of (method ),
194
+ createForwardingMethod (subclass , providerTypeName , method , false ));
194
195
}
195
196
196
197
// If a decorator is associated:
@@ -862,7 +863,8 @@ private boolean isDecorated(Set<MethodDescriptor> decoratedMethodDescriptors, Me
862
863
return false ;
863
864
}
864
865
865
- static MethodDescriptor createForwardingMethod (ClassCreator subclass , String providerTypeName , MethodInfo method ) {
866
+ static MethodDescriptor createForwardingMethod (ClassCreator subclass , String providerTypeName , MethodInfo method ,
867
+ boolean isInterface ) {
866
868
MethodDescriptor methodDescriptor = MethodDescriptor .of (method );
867
869
String forwardMethodName = method .name () + "$$superforward" ;
868
870
MethodDescriptor forwardDescriptor = MethodDescriptor .ofMethod (subclass .getClassName (), forwardMethodName ,
@@ -876,7 +878,9 @@ static MethodDescriptor createForwardingMethod(ClassCreator subclass, String pro
876
878
}
877
879
MethodDescriptor virtualMethod = MethodDescriptor .ofMethod (providerTypeName , methodDescriptor .getName (),
878
880
methodDescriptor .getReturnType (), methodDescriptor .getParameterTypes ());
879
- forward .returnValue (forward .invokeSpecialMethod (virtualMethod , forward .getThis (), params ));
881
+ forward .returnValue (isInterface
882
+ ? forward .invokeSpecialInterfaceMethod (virtualMethod , forward .getThis (), params )
883
+ : forward .invokeSpecialMethod (virtualMethod , forward .getThis (), params ));
880
884
return forwardDescriptor ;
881
885
}
882
886
@@ -908,8 +912,8 @@ static void createInterceptedMethod(MethodInfo method, ClassCreator subclass, Fi
908
912
for (int i = 0 ; i < parameters .size (); ++i ) {
909
913
params [i ] = notConstructed .getMethodParam (i );
910
914
}
911
- if (Modifier .isAbstract (method . flags () )) {
912
- notConstructed .throwException (IllegalStateException .class , "Cannot delegate to an abstract method" );
915
+ if (method .isAbstract ()) {
916
+ notConstructed .throwException (IllegalStateException .class , "Cannot invoke abstract method" );
913
917
} else {
914
918
notConstructed .returnValue (notConstructed .invokeVirtualMethod (forwardMethod , notConstructed .getThis (), params ));
915
919
}
0 commit comments