Bug 7456 - Error message with overloaded methods is confusing
Summary: Error message with overloaded methods is confusing
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-10 16:02 EST by Nick Edgar CLA
Modified: 2002-03-01 04:36 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2002-01-10 16:02:49 EST
Build 20020109

I was writing a junit test which did the following:
	float x = p.getX();
	assertEquals("0,0", 0f, x);

It gave me a compiler error saying that:
The method assertEquals(byte, byte) ... is not applicable for the arguments 
(java.lang.String, float, float).

I was trying to target the assertEquals methods for floats, which does exist.
However, it has an extra argument, float delta.
That is, the signature is assertEquals(String, float, float, float).

It took me a while to figure this out.  At first I thought it was a compiler 
bug in resolution of overloaded methods, since I thought there was an 
assertEquals(String, float, float).

It would be nice if the error message either mentioned the closest match, or 
had a more generic message which did not refer to any particular concrete 
method.  For example,
There is no method named assertEquals which is applicable for the arguments 
(java.lang.String, float, float).
Comment 1 Philipe Mulet CLA 2002-01-11 04:52:41 EST
Error message could indeed be improved
Comment 2 Kent Johnson CLA 2002-02-25 15:50:14 EST
We now try to find a better match so cases when the parameter order is wrong or 
you are missing a parameter will be more helpful.