Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make eclipse remove unused imports but keep unresolved

Tags:

eclipse

Is there a way to make Eclipse keep used but unresolved imports?

I'm using Eclipse's save actions to remove unused imports. Unfortunately it also removes imports that are used, but not unresolved.

In the example below, eclipse will remove GeneratedClass, if I save MyClass before generating the GeneratedClass. When I late generate the code, MyClass will be missing the import.

import a.b.GeneratedClass;
public class MyClass extend GeneratedClass {}
like image 565
Tobber Avatar asked Oct 06 '22 22:10

Tobber


1 Answers

Thanks to Bananeweizen and Krispy for their contributions, but so far it seems that the answer to this question is No.

The most efficient work around for me, is just to hit ctrl+z every time I save a file with unresolved imports.

I have submitted a bug to Eclipse's bugtracker: https://bugs.eclipse.org/bugs/show_bug.cgi?id=395538

This Eclipse bug tracks this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=357795

like image 74
Tobber Avatar answered Oct 10 '22 02:10

Tobber