| Summary: | [1.5] Java Compiler incorrectly warns that a cast from Integer to int is unnecessary | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Rune Glerup <rune.glerup> |
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | daniel_megert, Olivier_Thomann, simon.goodall, srikanth_sankaran, stephan.herrmann |
| Version: | 3.7 | ||
| Target Milestone: | 4.16 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
*** Bug 371597 has been marked as a duplicate of this bug. *** 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. Looks like this got fixed some time ago. (In reply to Dani Megert from comment #4) > Looks like this got fixed some time ago. no, the bogus warning is still raised (if enabled). *** This bug has been marked as a duplicate of bug 418795 *** |
Build Identifier: 20100617-1415 The Eclipse Java compiler incorrectly reports that a cast from Integer to int is unnecessary. Consider the following code: public class Test { public static void main(String... args) { Integer a = new Integer(10); Integer b = new Integer(10); boolean abEqual = (int)a == (int)b; System.out.println(abEqual); } } Here the program will not produce the same result, if the casts are removed. Reproducible: Always Steps to Reproduce: 1. Compile the example program 2. Run the program: Prints 'true' 3. Remove the casts 4. Re-compile the program 5. Run the program: Prints 'false'