| Summary: | [quick fix] Add cast casts to wrong type if incorrect type is in same package | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Neale Upstone <neale> | ||||
| Component: | UI | Assignee: | Benno Baumgartner <benno.baumgartner> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | benno.baumgartner, Olivier_Thomann | ||||
| Version: | 3.3 | ||||||
| Target Milestone: | 3.4 M1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Move to JDT/UI Created attachment 75202 [details]
fix
fixed > I20070731-0800 Holy **** guys. Is there a competition for the fastest turnaround from bug report to fix? If so, I think you might have won. Nice work! :-) Thanks! It's a simple fix and it is less work to fix it right away then to look at it again, that's all. Closing. Verified in Eclipse 3.4.1 |
Build ID: I20070621-1340 The assignment quick fix, "add cast" can break code if the cast is to a type that is also visible in the current package, and is used in the class. e.g. package org.bah; class MyClass { }; package com.foo; class MyClass { }; package com.foo; class MyOtherClass { org.bah.MyClass otherPackage ref = new Object(); // fails to compile MyClass localPackageRef; } When the quick fix is applied, it offers to cast to org.bah.MyClass, but inserts an import which then masks the local package MyClass and incorrectly changes its' type. The correct behaviour would be that no import statement is generated, and the line becomes: org.bah.MyClass otherPackage ref = (org.bah.MyClass)new Object(); More information: