[jboss-jira] [JBoss JIRA] (JASSIST-127) interface proxy creation fails if there are methods with covariant return types
Brice Dutheil (JIRA)
jira-events at lists.jboss.org
Wed Mar 21 17:08:48 EDT 2012
[ https://issues.jboss.org/browse/JASSIST-127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678481#comment-12678481 ]
Brice Dutheil commented on JASSIST-127:
---------------------------------------
The proposed solution doesn't work, the JVM raises an AbstractMethodError on the call site.
What happen is that the proposed solution discard method with same name / same argument as the return type is not taken into account when generating the key in getMethods.
Reverting the actual patch raises DuplicateMemberException because ClassFile.isDuplicated don't see either of these method as bridge.
I've created a patch that detect methods with covariant type and mark forwarding methods as bridge in relevant scenarios.
Also, I'm not sure of that one but the path also adds a boolean to enable the MethodHandler to intercept bridge methods.
> interface proxy creation fails if there are methods with covariant return types
> -------------------------------------------------------------------------------
>
> Key: JASSIST-127
> URL: https://issues.jboss.org/browse/JASSIST-127
> Project: Javassist
> Issue Type: Bug
> Affects Versions: 3.12.0.GA
> Environment: Java 1.6.
> Reporter: Paul Pogonyshev
> Assignee: Shigeru Chiba
> Labels: patch
> Fix For: 3.16.0-GA
>
> Attachments: jassist-127-fix.diff
>
>
> Creation of proxy class for interface Bar fails:
> public interface Foo
> {
> Foo getSelf ();
> }
> public interface Bar extends Foo
> {
> Bar getSelf ();
> }
> This is because of covariant return types of method getSelf(). However, as this is permitted by the language (i.e. subtype can restrict the return type further), I consider this a bug.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list