[ 
https://issues.apache.org/jira/browse/TAP5-729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship updated TAP5-729:
--------------------------------------

    Labels: bulk-close-candidate generics  (was: bulk-close-candidate)
    
> Tapestry IOC proxies have incorrect implementation when interface method uses 
> a covariant return type (causes AbstractMethodError)
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-729
>                 URL: https://issues.apache.org/jira/browse/TAP5-729
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-ioc
>    Affects Versions: 5.1.0.5
>            Reporter: Paul Field
>              Labels: bulk-close-candidate, generics
>
> Here's a Junit 3 test case to demonstrate:
> import junit.framework.TestCase;
> import org.apache.tapestry5.ioc.Registry;
> import org.apache.tapestry5.ioc.RegistryBuilder;
> import org.apache.tapestry5.ioc.ServiceBinder;
> public class ProxyText extends TestCase {
>     private Registry registry;
>     @Override
>     protected void setUp() throws Exception {
>         RegistryBuilder builder = new RegistryBuilder();
>         builder.add(AppModule.class);
>         registry = builder.build();
>         registry.performRegistryStartup();
>     }
>     public void testRegistryWorks() {
>         assertEquals(new Integer(1), 
> registry.getService(SuperIFace.class).get());
>     }
>     public static class AppModule {
>         public static void bind(ServiceBinder binder) {
>             binder.bind(IFace.class, Impl.class);
>         }
>     }
>     public interface SuperIFace {
>         Number get();
>     }
>     public interface IFace extends SuperIFace {
>         Integer get();
>     }
>     public static class Impl implements IFace {
>         public Integer get() {
>             return 1;
>         }
>     }
> }
> ----- 
> The result is:
> java.lang.AbstractMethodError: $IFace_1218d10684a.get()Ljava/lang/Number;
> Note that if you change SuperIFace to:
>     public interface SuperIFace {
>         Integer get();
>     }
> the test works - demonstrating that the problem is to do with the use of a 
> covariant return type in IFace.
> BTW, this has turned up in code for testing where I want to create 
> sub-interfaces that provide additional testing facilities for fake services 
> and I need to control the particular types that are returned by the fake 
> implementation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to