Bug 511965 - Unused static import created when organizing imports
Summary: Unused static import created when organizing imports
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-09 06:14 EST by Clovis Seragiotto CLA
Modified: 2024-03-19 01:42 EDT (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 Clovis Seragiotto CLA 2017-02-09 06:14:07 EST
For the following class

package a;

interface Foo {
    static void x() {  }
    
    class Bar implements Foo {
        static void y() { x(); }
    }
}

"organize imports" automatically adds "import static a.Foo.x;". And then the compiler complains that this import is never used.
Comment 1 Eclipse Genie CLA 2019-02-01 14:06:43 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 2 Clovis Seragiotto CLA 2019-02-04 00:49:34 EST
The problem still occurs (Eclipse 2018-12)
Comment 3 Jay Arthanareeswaran CLA 2019-02-04 04:33:19 EST
Vikas, this looks like a good candidate for you. Can you take a look at this?
Comment 4 Vikas Chandra CLA 2019-02-04 04:50:22 EST
>>Can you take a look at this?

I will have a look.
Comment 5 Clovis Seragiotto CLA 2019-04-04 03:02:25 EDT
… and if x() is declared as private in the example, as in

interface Foo {
    private static void x() {  }
    …
}

then the compiler complains that the import cannot be resolved.
Comment 6 Eclipse Genie CLA 2019-05-10 06:33:16 EDT
New Gerrit change created: https://git.eclipse.org/r/141951
Comment 7 Eclipse Genie CLA 2019-05-10 08:27:18 EDT
New Gerrit change created: https://git.eclipse.org/r/141960
Comment 8 Eclipse Genie CLA 2021-04-30 04:43:51 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.

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 9 Eclipse Genie CLA 2021-04-30 04:43:51 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.
Comment 10 Clovis Seragiotto CLA 2021-04-30 04:46:32 EDT
The useless import is still generated.
Comment 11 Eclipse Genie CLA 2024-03-19 01:42:12 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.

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.