Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 484727

Summary: [refactor] Import static doesn't work when static method is referenced from subtype
Product: [Eclipse Project] JDT Reporter: Lukas Eder <lukas.eder>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: fabian.pfaff, gautier.desaintmartinlacaze, jjohnstn, noopur_gupta
Version: 3.8.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Lukas Eder CLA 2015-12-19 13:49:19 EST
Consider the following classes:

------------------------------------------------------------
package x;

public class A {
    public static void m() {}
}
------------------------------------------------------------
package x;

public class B extends A {

}
------------------------------------------------------------
import x.B;

public class Test {
    void x() {
        B.m();
    }
}
------------------------------------------------------------

I want to be able to click on "m()" and static-import the method via Ctrl+Shift+M or "Right click > Source > Add Import". If I do this, nothing happens. If I do Ctrl+Shift+M on "m()" in the following class, it works:

------------------------------------------------------------
import static x.A.m;

public class Test {
    void x() {
        m();
    }
}
------------------------------------------------------------
Comment 1 Noopur Gupta CLA 2016-01-08 01:05:32 EST
Reproducible in Eclipse 3.8.1 also.
Comment 2 Eclipse Genie CLA 2019-04-30 17:37:25 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 3 Lukas Eder CLA 2020-03-20 11:22:47 EDT
The issue still persists
Comment 4 Eclipse Genie CLA 2022-09-22 11:45: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.

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 Jeff Johnston CLA 2022-11-08 16:25:27 EST
Fixed in 4.26 M3.