[
https://issues.apache.org/jira/browse/TAP5-2667?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thiago Henrique De Paula Figueiredo closed TAP5-2667.
-----------------------------------------------------
Fix Version/s: 5.8.2
Resolution: Fixed
> 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.5.0, 5.6.2, 5.7.0, 5.7.1, 5.7.2, 5.7.3, 5.8.0, 5.8.1
> Reporter: Piotr Czerwik
> Assignee: Thiago Henrique De Paula Figueiredo
> Priority: Major
> Fix For: 5.8.2
>
>
> 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.20.7#820007)