Bug 241841

Summary: [compiler] Compilation error 'incompatible types' should use full qualified class names
Product: [Eclipse Project] JDT Reporter: Bauke Scholtz <balusc>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: marcin.kowalski.pl, Olivier_Thomann, philippe_mulet
Version: 3.4   
Target Milestone: 3.5 M1   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Bauke Scholtz CLA 2008-07-23 13:06:43 EDT
Build ID: M20071023-1652

Steps To Reproduce:

java.sql.Date d = new java.util.Date();

Eclipse says: 'cannot convert from Date to Date' which doesn't make any sense.

Javac says: 'incompatible types; found: java.util.Date; required: java.sql.Date' which makes much more sense.

The same applies to other classes with the same name, e.g. java.sql.ResultSet and com.mysql.jdbc.ResultSet.

Please make the compilation error more descriptive by using full qualified class names.
Comment 1 Olivier Thomann CLA 2008-07-23 13:15:30 EDT
I would say we should use fully qualified name only when the simple names are identical. This would keep the messages shorter in most cases.
Comment 2 Bauke Scholtz CLA 2008-07-23 13:16:44 EDT
Also good. That's always better than nothing.
Comment 3 Olivier Thomann CLA 2008-07-23 14:57:29 EDT
Created attachment 108255 [details]
Proposed fix

Probably need to update some regression tests.
Comment 4 Olivier Thomann CLA 2008-07-24 10:06:35 EDT
Released for 3.5M1.
Added regression test org.eclipse.jdt.core.tests.compiler.regression.AssignmentTest#test61
Comment 5 Bauke Scholtz CLA 2008-07-24 10:07:52 EDT
Great, thank you.
Comment 6 Olivier Thomann CLA 2008-07-24 10:19:13 EDT
No problem. You can check next integration build to see if this is what you expected.
Comment 7 Kent Johnson CLA 2008-08-06 12:46:57 EDT
Verified for 3.5M1 using I20080805-1307
Comment 8 Philipe Mulet CLA 2008-08-25 07:13:55 EDT
I believe there are other problem scenarii where names should be disambiguated (other flavors of incompatible types) as well.
Comment 9 Philipe Mulet CLA 2008-08-25 07:17:30 EDT
*** Bug 192856 has been marked as a duplicate of this bug. ***
Comment 10 Philipe Mulet CLA 2008-08-26 12:28:14 EDT
e.g.
public class X {
	class Member {}
	void foo() {
		new p.X().new Member();
	}
}
Comment 11 Philipe Mulet CLA 2008-08-26 12:31:54 EDT
e.g.
public class X extends Throwable {
	public void foo() throws p.X {}
}
Comment 12 Philipe Mulet CLA 2008-08-26 12:41:05 EDT
e.g.
public class X extends Throwable {
	void foo() throws X {
		throw new p.X();
	}
}
Comment 13 Philipe Mulet CLA 2008-08-26 12:42:55 EDT
Also senders of ProblemReporter methods:
incompatibleExceptionInThrowsClause(...)
incompatibleReturnType(...)
invalidEnclosingType(...)
javadoc counterparts
unsafeCast(...)
unsafeTypeConversion(...)

etc.
Comment 14 Olivier Thomann CLA 2008-08-26 12:46:59 EDT
Ok, I'll take a look.