I'm currently having a problem generating proxies for classes that have a structure similar to the example below. The issue comes in when a sub-class overrides a method and makes the return type more specific.
| import junit.framework.TestCase; | | public class ClassProxyBugTest extends TestCase | { | public void testFunctionOverride() throws Exception | { | ClassProxyFactory.newInstance(BB.class); | } | } | | | interface AA | { | public XX getFoo(); | } | | class BB implements AA | { | public BB() {} | | public YY getFoo() | { | return new YY(); | } | } | | interface XX | { | | } | | class YY implements XX | { | | } | Here's the stack trace: | javassist.CannotCompileException: duplicate method: getFoo | at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:544) | at javassist.bytecode.ClassFile.addMethod(ClassFile.java:528) | at javassist.CtClassType.addMethod(CtClassType.java:1099) | at org.jboss.aop.proxy.ClassProxyFactory.createProxyCtClass(ClassProxyFactory.java:300) | at org.jboss.aop.proxy.ClassProxyFactory.generateProxy(ClassProxyFactory.java:308) | at org.jboss.aop.proxy.ClassProxyFactory.getProxyClass(ClassProxyFactory.java:86) | at org.jboss.aop.proxy.ClassProxyFactory.newInstance(ClassProxyFactory.java:98) | at org.jboss.aop.proxy.ClassProxyFactory.newInstance(ClassProxyFactory.java:67) | at org.jboss.aop.proxy.ClassProxyFactory.newInstance(ClassProxyFactory.java:62) | at com.polycom.proximo.learn.ClassProxyBugTest.testFunctionOverride(ClassProxyBugTest.java:12) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:585) | at junit.framework.TestCase.runTest(TestCase.java:164) | at junit.framework.TestCase.runBare(TestCase.java:130) | at junit.framework.TestResult$1.protect(TestResult.java:110) | at junit.framework.TestResult.runProtected(TestResult.java:128) | at junit.framework.TestResult.run(TestResult.java:113) | at junit.framework.TestCase.run(TestCase.java:120) | at junit.framework.TestSuite.runTest(TestSuite.java:228) | at junit.framework.TestSuite.run(TestSuite.java:223) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) | | I've tested this with jboss aop 1.5.0 GA. After looking at the code a bit, it looks like the problem lies in org.jboss.aop.util.JavassistMethodHashing. The hashing algorithm doesn't seem to take this type of method declaration into account. I have not opened a JIRA issue with the problem yet but I could if necessary. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3954745#3954745 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3954745 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user