[ nice-Feature Requests-1629855 ] Better compiler warnings for ambiguous methods

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

[ nice-Feature Requests-1629855 ] Better compiler warnings for ambiguous methods

by SourceForge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Feature Requests item #1629855, was opened at 2007-01-07 12:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=362788&aid=1629855&group_id=12788

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: David R. MacIver (drmaciver)
Assigned to: Nobody/Anonymous (nobody)
Summary: Better compiler warnings for ambiguous methods

Initial Comment:
Currently it's very easy to create ambiguous methods without being warned about it. Some examples:

class Foo { }
class Bar extends Foo { }

// Compiles without a twitch.
void doStuff(Foo foo1, Foo foo2) { }
void doStuff(Foo foo1, Bar foo2) { }
void doStuff(Bar foo1, Foo foo2) { }

// Doesn't compile
doStuff(new Bar(), new Bar());

Another example which the compiler doesn't catch (and is probably never intentional):

let String foo = "foo";

public void doStuff(String string) { }

doStuff(foo) { System.out.println("Hi!"); }
doStuff("foo") { System.out.println("Bye!"); }

Ambiguous methods aren't neccessarily a problem and presumably can be deliberate in some cases, so this probably shouldn't be considered an error. It would however be very useful if the compiler could warn when you've done this.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=362788&aid=1629855&group_id=12788

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nice-info mailing list
Nice-info@...
https://lists.sourceforge.net/lists/listinfo/nice-info
LightInTheBox - Buy quality products at wholesale price