You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2015/08/03 09:52:04 UTC
[jira] [Resolved] (TAP5-729) Tapestry IOC proxies have incorrect
implementation when interface method uses a covariant return type (causes
AbstractMethodError)
[ https://issues.apache.org/jira/browse/TAP5-729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jochen Kemnade resolved TAP5-729.
---------------------------------
Resolution: Not A Problem
We'll assume that this is no longer a problem.
> 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: 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 was sent by Atlassian JIRA
(v6.3.4#6332)