Project: JDT
Bug 140565 [clean up] 'change all acces through instances' + 'remove unused imports' leads to code with fatal errors
Reported: 2006-05-08 10:12:22 | Status: verified fixed

Version: 3.2.0 RC2 Build id: I20060428-1315 Given are the following example classes: ClassA.java: public class ClassA { static ClassB instanceOfClassB; } ClassB.java: public class ClassB { static ClassC instanceOfClassC; } ClassC.java: public class ClassC { static ClassD instanceOfClassD; } ClassD.java: public class ClassD { } Example.java: import java.io.*; public class Example { private void testFunction() { ClassA.instanceOfClassB.instanceOfClassC.instanceOfClassD.toString(); } } A 'clean up' of Example.java with 'change all acces through instances' and 'remove unused imports' checked lead's to ClassBClassA.instanceOfClassC.instanceOfClassD.toString(); which renders the code unusable. It should at least lead to ClassB.instanceOfClassC.instanceOfClassD.toString(); or to ClassD.toString(); Best regards Thomas Boeck

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CodeStyleFix.java