[jira] Created: (BOO-851) Automatic interface stubbing can create method conflicts

View: New views
2 Messages — Rating Filter:   Alert me  

[jira] Created: (BOO-851) Automatic interface stubbing can create method conflicts

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Automatic interface stubbing can create method conflicts
--------------------------------------------------------

                 Key: BOO-851
                 URL: http://jira.codehaus.org/browse/BOO-851
             Project: Boo
          Issue Type: Bug
            Reporter: Avishay Lavie
            Priority: Minor


When the compiler automatically adds stubs for unimplemented interface methods, they can conflict with other defined or stubbed methods which differ by return type only.

Failing testcase:

{code}
import System.Collections.Generic

public class StubMePlease(IEnumerable of int):
    pass
{code}

The compiler will create a stub for "GetEnumerator() as IEnumerator" as defined by IEnumerable, and for "GetEnumerator() as IEnumerator of int" as defined by IEnumerable of int. The two methods, differing only by return type, create a conflict.

Proposed solution: use explicit interface implementation for interface stubs. This will work well since the stubs are empty anyway, so there's no use in listing them as public members of the stubbed class.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


[jira] Updated: (BOO-851) Automatic interface stubbing can create method conflicts

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/BOO-851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Nagel updated BOO-851:
---------------------------

    Attachment: BOO-851.patch

Created a patch for the issue, thought it breaks several test cases (which rely on the old behavior).

These are the tests that fail:

tests\testcases\warnings\BCW0011-6.boo
tests\testcases\semantics\interfaces-0.boo
tests\testcases\semantics\interfaces-2.boo
tests\testcases\integration/types\interfaces-15.boo
tests\testcases\integration/types\interfaces-16.boo
tests\testcases\integration/types\interfaces-18.boo

Any code affected by this was getting a warning anyway, so it's not really a breaking change.

> Automatic interface stubbing can create method conflicts
> --------------------------------------------------------
>
>                 Key: BOO-851
>                 URL: http://jira.codehaus.org/browse/BOO-851
>             Project: Boo
>          Issue Type: Bug
>            Reporter: Avishay Lavie
>            Priority: Minor
>         Attachments: BOO-851.patch
>
>
> When the compiler automatically adds stubs for unimplemented interface methods, they can conflict with other defined or stubbed methods which differ by return type only.
> Failing testcase:
> {code}
> import System.Collections.Generic
> public class StubMePlease(IEnumerable of int):
>     pass
> {code}
> The compiler will create a stub for "GetEnumerator() as IEnumerator" as defined by IEnumerable, and for "GetEnumerator() as IEnumerator of int" as defined by IEnumerable of int. The two methods, differing only by return type, create a conflict.
> Proposed solution: use explicit interface implementation for interface stubs. This will work well since the stubs are empty anyway, so there's no use in listing them as public members of the stubbed class.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email