Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Problem
-
5.1.0.5
-
None
Description
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
public void testRegistryWorks()
{ assertEquals(new Integer(1), registry.getService(SuperIFace.class).get()); } public static class AppModule {
public static void bind(ServiceBinder binder)
}
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.