Bug 480127 - [organise imports] happily removes static imports
Summary: [organise imports] happily removes static imports
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5.1   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2015-10-19 10:26 EDT by Ferry Huberts CLA
Modified: 2020-04-30 12:51 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ferry Huberts CLA 2015-10-19 10:26:16 EDT
In one of my Junit test classes the import organiser happily removes static imports.

This seems to happen to a modified file, which is saved, with 'organise imports on save' enabled.

This does NOT seem to happen when explicit invoked on a saved file.


These are remove (but really used):
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;
Comment 1 Ferry Huberts CLA 2015-10-19 10:29:15 EDT
this didn't happen with 4.5.0: regression
Comment 2 Ferry Huberts CLA 2016-02-17 11:00:06 EST
This only happens when there are compile errors in the java file.

"Rather" annoying.
Comment 3 Ferry Huberts CLA 2016-02-17 11:15:45 EST
(In reply to Ferry Huberts from comment #2)
> This only happens when there are compile errors in the java file.
> 
> "Rather" annoying.

Ah, no.
Just had it happen to a file without compile errors.
I did an 'organise imports' on the file and the static imports were removed.
Comment 4 Jay Arthanareeswaran CLA 2016-04-12 02:57:55 EDT
Ferry, it would help if you can share the code where you see this problem, ideally isolated in a small testcase. I tried out a bit but can't reproduce this problem.
Comment 5 Ferry Huberts CLA 2016-04-12 03:49:10 EDT
Well that is the problem: sometimes it does this but most of the time it doesn't.
Comment 6 Eclipse Genie CLA 2020-04-30 12:51:07 EDT
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.