Community
Participate
Working Groups
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.
This should be a rare situation, maybe some hover indication could address this one as well...
*** Bug 154633 has been marked as a duplicate of this bug. ***
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".
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.
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.
I have been bitten by this in the past too. Shankha, would like to take a look?
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.
This has already been fixed via bug 415291. *** This bug has been marked as a duplicate of bug 415291 ***
(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?
(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.
Verified for Eclipse 2019-09 (4.13) M3 with Build id: I20190820-1800