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
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.
-
You can reply to this email to add a comment to the issue online.