Skip to content

[Clean-up] "Removed unused imports" is applied too late and an unnecessary import survives the cleanup #2222

@fedejeanne

Description

@fedejeanne

To reproduce

  • Create these 4 classes:
package a;

import b.ChildClass;
import b.ParentClass;

public class Snippet {
	public static void main(String[] args) {
		Util.doNothing(new ParentClass[] {new ChildClass()});
	}
}

package a;

import b.ParentClass;

public class Util {
	static void doNothing(ParentClass... p) {}
}

package b;

public class ChildClass extends ParentClass {}

package b;

public class ParentClass {}
  • Apply these 2 cleanups in the project (they are in the tab called Unnecessary code)

Image

Expected result
The class Snippet looks like this:

package a;

import b.ChildClass;

public class Snippet {
	public static void main(String[] args) {
		Util.doNothing(new ChildClass());
	}
}

Actual result
There is 1 unnecessary import: import b.ParentClass;

package a;

import b.ChildClass;
import b.ParentClass;

public class Snippet {
	public static void main(String[] args) {
		Util.doNothing(new ChildClass());
	}
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions