[Java Spec Report] co-variant return types

"Timothy Hanson" <[email protected]> Thu, 17 Jun 2004 17:20:52 -0700
Newsgroups gmane.comp.java.spec-report
Message-ID <[email protected]>
What does the current spec say about the requirements for co-variant return types? The version I have says "This specification requires that the result type of a method is a subtype of the result types of all methods it overrides."

But javac accepts both of the following overrides:

--------------------------------------------
public class Test extends Base {
    Collection getC() { return null; }
    String[] getO() { return null; }
}

class Base {
    Collection<String> getC() { return null; }
    Object[] getO() { return null; }
}
--------------------------------------------

Has the spec changed to assignment convertible for reference types?

Thanks,
Tim


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe from this mailing list, send an email to:
[email protected]
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/java-spec-report/

<*> To unsubscribe from this group, send an email to:
     [email protected]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/