Bug 560631 - "Remove unused imports" does not work (anymore)
Summary: "Remove unused imports" does not work (anymore)
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2020-02-28 05:23 EST by M H CLA
Modified: 2024-02-18 07:17 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M H CLA 2020-02-28 05:23:23 EST
I wonder why we have so many warnings about unused import statements. I checked

Preferneces > Java > Code STyle > Clean Up 

and the active profile is "Eclipse [built-in]" with details:

...
Remove unused imports
...

But it doesn't work as all our projects have these warnings and changing the source file doe not remove those unused imports.
Comment 1 Michael Keppler CLA 2020-02-29 14:01:20 EST
Works fine for me in 4.15 M3.
Comment 2 Stephan Herrmann CLA 2020-02-29 15:20:30 EST
(In reply to M H from comment #0)
> I wonder why we have so many warnings about unused import statements.

Maybe those are only reported since bug 559618?

Please provide an example with steps for reproducing.
Comment 3 M H CLA 2020-03-02 02:33:31 EST
I found a problem:

There is also a

Preferences > Java > Editor > Save Actions > "Organize imports"

After checking this, the removal works.

Well this is misleading, as "Additional actions" in the same preferences does NOT contain "remove unused imports" as

Preferences > Java > Code Style > Clean Up

has - and you can't change/add it.

In brief: Clean Up > Eclipse [built in] does NOT "Remove unused imports" is Save Actiopns > Organize imports is NOT checked!

This is either a bug or a missing information when you just see the Clean Up dialog with "Remove unused imports".
Comment 4 Eclipse Genie CLA 2022-02-22 18:27:45 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Eclipse Genie CLA 2024-02-18 07:17:04 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.