You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Piotr Czerwik (Jira)" <ji...@apache.org> on 2021/03/11 14:24:00 UTC
[jira] [Created] (TAP5-2667) Plastic class should exclude interface
static methods
Piotr Czerwik created TAP5-2667:
-----------------------------------
Summary: Plastic class should exclude interface static methods
Key: TAP5-2667
URL: https://issues.apache.org/jira/browse/TAP5-2667
Project: Tapestry 5
Issue Type: Bug
Components: plastic
Affects Versions: 5.7.0, 5.6.2, 5.5.0
Reporter: Piotr Czerwik
Sample code to reproduce:
{code:java}
public interface SampleService {
static String sampleStaticMethod() {
return "whatever";
}
String sampleMethod();
} {code}
{code:java}
public class SampleServiceImpl implements SampleService {
@Override
public String sampleMethod() {
return "whatever";
}
} {code}
{code:java}
public class AppModule {
public static void bind(ServiceBinder binder) {
binder.bind(SampleService.class, SampleServiceImpl.class);
}
@Match("*SampleService")
public static void adviseSampleService(MethodAdviceReceiver receiver) {
receiver.adviseAllMethods(MethodInvocation::proceed);
}
...
} {code}
The code will fail with the following exception:
{code:java}
... ...Caused by: java.lang.RuntimeException: Exception constructing service 'SampleService': Unable to ... at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:76) ~[tapestry-ioc-5.5.0.jar:?] at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:55) ~[tapestry-ioc-5.5.0.jar:?] ...Caused by: java.lang.IllegalArgumentException: Unable to introduce method 'public static java.lang.String sampleStaticMethod()' into class $SampleService_24850593ea4b7: introduced methods may not be static. at org.apache.tapestry5.internal.plastic.PlasticClassImpl.createNewMethod(PlasticClassImpl.java:984) ~[plastic-5.5.0.jar:?] at org.apache.tapestry5.internal.plastic.PlasticClassImpl.introduceMethod(PlasticClassImpl.java:938) ~[plastic-5.5.0.jar:?] at org.apache.tapestry5.internal.plastic.PlasticClassImpl.introduceMethod(PlasticClassImpl.java:966) ~[plastic-5.5.0.jar:?] at org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl$1.transform(PlasticProxyFactoryImpl.java:138) ~[beanmodel-5.5.0.jar:?] at org.apache.tapestry5.plastic.PlasticManager.createProxy(PlasticManager.java:287) ~[plastic-5.5.0.jar:?]
...{code}
I guess {{PlasticProxyFactoryImpl#createProxy}} (around lines 136-138 for 5.5.0 and 5.6.2, 138-141 for 5.7.0) should exclude the static interface methods.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)