Hi
When deploying a Bean (using Java Generics) on the server side, within an application context using <tx:annotation-driven transaction-manager="transactionManager"/> support, the BridgeMethodResolver is throwing an exception.
This only occurs when the Bean attempts to override the methods within the generic super class, and where this super class implements a generic interface.
Currently, I am unsure whether this is due to a misuse (or overuse) of generics, or whether it is a genuine bug within the BridgeMethodResolver.
I have a test case hopefully explaining the issue as follows. Any help would be greatly appreciated.
Abstract Domain Super
Domain ObjectCode:public abstract class DomainObjectSuper { }
Generic Logic InterfaceCode:public class DomainObjectExtendsSuper extends DomainObjectSuper { }
Base Logic ImplementationCode:public interface IGenericInterface<D extends DomainObjectSuper> { <T> void doSomething(final D domainObject, final T value); }
True Logic ImplementationCode:public abstract class AbstractImplementsInterface<D extends DomainObjectSuper> implements IGenericInterface<D> { public <T> void doSomething(D domainObject, T value) { // Base implementation of Functionality } public void anotherBaseMethod() { } }
Test CaseCode:public class ExtendsAbstractImplementsInterface extends AbstractImplementsInterface<DomainObjectExtendsSuper> { @Override public <T> void doSomething(DomainObjectExtendsSuper domainObject, T value) { // Override the default implementation super.doSomething(domainObject, value); } }
Exception ThrownCode:public class GenericLogicTest extends TestCase { public void testSample() { Method[] methods = ExtendsAbstractImplementsInterface.class.getMethods(); for (Method method : methods) { BridgeMethodResolver.findBridgedMethod(method); } } }
Code:java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public volatile void base.package.domain.ExtendsAbstractImplementsInterface.doSomething(base.package.domain.DomainObjectSuper,java.lang.Object)' at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:91)


Reply With Quote