Community
Participate
Working Groups
package bug; import bug.a.A; public class B { public B() { A.bbb(); // invokde quick assist A.bbb(); new A().bbb(); new A().ccc(); // ccc is a non static method } } Using the quick assist to replace all static import occurrences removes the non static import import bug.a.A; which leads to compilation error for 2 lines. new A().bbb(); new A().ccc();
New Gerrit change created: https://git.eclipse.org/r/133226
Looks good for RC2.
Gerrit change https://git.eclipse.org/r/133226 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=d158a1305a1a680cd0d39d3213feb718c0b9b3d2
The actual issue is still not fixed. If you have the following code: package p2; import pkg.A; public class B { public B() { A.bbb(); System.out.println(A.class); } } and invoke quick assist on #bbb, it still removes the import for A causing compile error. You can check the ImportRewrite APIs which automatically detect if an import is still being referenced in the file as the expression could be anything and present anywhere in the file. For example, consider a single file having: package p2; import pkg.A; public class B { public B() { A.bbb(); } } class C { { System.out.println(A.class); } } Fabian, please open a new bug for 4.11 to fix this.
(In reply to Noopur Gupta from comment #4) > The actual issue is still not fixed. If you have the following code: > > package p2; > > import pkg.A; > > public class B { > public B() { > A.bbb(); > System.out.println(A.class); > } > } > > and invoke quick assist on #bbb, it still removes the import for A causing > compile error. > > You can check the ImportRewrite APIs which automatically detect if an import > is still being referenced in the file as the expression could be anything > and present anywhere in the file. For example, consider a single file having: > > package p2; > > import pkg.A; > > public class B { > public B() { > A.bbb(); > } > } > > class C { > { > System.out.println(A.class); > } > } > > Fabian, please open a new bug for 4.11 to fix this. Created bug 542653.