Bug 105658 - Possibly Misleading Type mismatch error message
Summary: Possibly Misleading Type mismatch error message
Status: VERIFIED DUPLICATE of bug 415291
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: BETA J8   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard: To be verified for 4.13 M3
Keywords:
: 154633 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-08-01 06:05 EDT by Andrew J Huff CLA
Modified: 2019-08-20 23:32 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew J Huff CLA 2005-08-01 06:05:11 EDT
Problem originally reported as bug 105580 in AspectJ, reproduced in jdt with
Eclipse 3.1.0, Build id: I20050627-1435.

With 2 classes a.C1 and b.C1, the following line:

a.C1 a = new b.C1();

yields this error message:

Type mismatch: cannot convert from C1 to C1.

While in this case it is pretty obvious what the problem is, this problem was
originally found when using a external API (Type mismatch: cannont convert from
Iterator to Iterator).

A simple fix would be to test for the case when the shortened name of both
classes are the same and instead give the full package name.  For example:

Type mismatch: cannot convert from b.C1 to a.C1.
Comment 1 Philipe Mulet CLA 2006-03-30 08:16:39 EST
This should be a rare situation, maybe some hover indication could address this one as well...
Comment 2 Markus Keller CLA 2007-01-15 09:38:59 EST
*** Bug 154633 has been marked as a duplicate of this bug. ***
Comment 3 Markus Keller CLA 2007-01-15 09:40:21 EST
Another example where the error message could be more precise:

package my;
public class String {
	String s= "Hello";
}

=> "Type mismatch: cannot convert from String to String".
Comment 4 Denis Roy CLA 2009-08-30 02:18:06 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 5 Monika Krug CLA 2013-08-06 19:27:33 EDT
Please fix this, it's super annoying, a tricky-to-find-out problem when it occurs, and it's not really rare at all - mixing up two variables / an actual and a formal parameter with just *seemingly* the same type (same short type, different package) is actually a very typical error that would lead to a type mismatch error.
Comment 6 Jay Arthanareeswaran CLA 2013-08-07 00:17:45 EDT
I have been bitten by this in the past too.

Shankha, would like to take a look?
Comment 7 Eclipse Genie CLA 2019-07-21 03:35:55 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 8 Jay Arthanareeswaran CLA 2019-08-07 01:44:20 EDT
This has already been fixed via bug 415291.

*** This bug has been marked as a duplicate of bug 415291 ***
Comment 9 Stephan Herrmann CLA 2019-08-07 11:39:14 EDT
(In reply to Jay Arthanareeswaran from comment #8)
> This has already been fixed via bug 415291.
> 
> *** This bug has been marked as a duplicate of bug 415291 ***

Jay, can you help me see the connection, or was it a mistyped bug number?
Comment 10 Jay Arthanareeswaran CLA 2019-08-07 23:37:28 EDT
(In reply to Stephan Herrmann from comment #9)
> Jay, can you help me see the connection, or was it a mistyped bug number?

Stephan, I didn't dig deep. But I saw that the change in ProblemReporter line number 8344 was part of bug 415291, which also fixed this bug.
Comment 11 Manoj N Palat CLA 2019-08-20 23:32:42 EDT
Verified for Eclipse 2019-09 (4.13) M3 with Build id: I20190820-1800