[jboss-jira] [JBoss JIRA] Issue Comment Edited: (JASSIST-127) interface proxy creation fails if there are methods with covariant return types

Peter Miklos (JIRA) jira-events at lists.jboss.org
Mon Nov 8 11:14:47 EST 2010


    [ https://jira.jboss.org/browse/JASSIST-127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561922#action_12561922 ] 

Peter Miklos edited comment on JASSIST-127 at 11/8/10 11:13 AM:
----------------------------------------------------------------

I have experienced with the same in version 3.11.0.GA (actually, it leads Weld to fail injecting beans when tries to proxy a class like that). Did some debugging and found that ClassFile.isDuplicated() might be fixed somewhere here:
...
        if (desc.equals(newDesc)) {
            if (notBridgeMethod(minfo))
                return true;
            else {
                it.remove();
                return false;
            }
        }
        else
           return notBridgeMethod(minfo) && notBridgeMethod(newMethod);

When method names are the same and return types differ the control flows to the last else statement and that point returns true.

      was (Author: pmiklos):
    I have experienced with the same in version 3.11.0.GA (actually, it leads Weld to fail injecting beans when tries to proxy a class like that). Did some debugging and found that ClassFile.isDuplicated() might be fixed somewhere here:
...
        if (desc.equals(newDesc)) {
            if (notBridgeMethod(minfo))
                return true;
            else {
                it.remove();
                return false;
            }
        }
        else
           return notBridgeMethod(minfo) && notBridgeMethod(newMethod);

When method names are the same and return types differ the control flows to the last else statement and that point returns false.
  
> interface proxy creation fails if there are methods with covariant return types
> -------------------------------------------------------------------------------
>
>                 Key: JASSIST-127
>                 URL: https://jira.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
>
> 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 contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list