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

Bug 221003

Summary: [inline] inline constant removes needed static import
Product: [Eclipse Project] JDT Reporter: Brian Miller <Brian.Miller>
Component: UIAssignee: Jeff Johnston <jjohnstn>
Status: VERIFIED FIXED QA Contact: Jeff Johnston <jjohnstn>
Severity: normal    
Priority: P3 CC: dma_k, jjohnstn, martinae, pyvesdev
Version: 3.3.1   
Target Milestone: 4.21 M1   
Hardware: PC   
OS: Windows XP   
See Also: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182194
https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=fd3b7a4a3e046735d4b0453ecc6b2fc8cf91e82f
Whiteboard: stalebug
Attachments:
Description Flags
Test classes none

Description Brian Miller CLA 2008-02-29 15:41:45 EST
Version: 3.3.1.1
Build id: M20071023-1652

Please see that inlining constant xyz wrongly removes a needed static import.  The result is illegal.

-------------------- Bug.java ----------------------
import static java.lang.Character.CONTROL;
class Bug { static final byte xyz=CONTROL,format=xyz; }
Comment 1 Dmitry Katsubo CLA 2017-11-16 11:51:22 EST
Created attachment 271501 [details]
Test classes

I confirm the issue for Eclipse 4.7.1. I have attached test scenario (test.7z) which contains class like this:

import static test.Utils.version;

public class Test {

    private static final String version = version();

    private void test() {
        String copy = version;
    }
}

After variable "version" is inlined, "import static" statement is gone and class is not compilable anymore:

public class Test {

    private void test() {
        String copy = version();
    }
}
Comment 2 Eclipse Genie CLA 2021-03-08 16:39:40 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 3 Eclipse Genie CLA 2021-06-18 15:37:03 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182194
Comment 5 Jeff Johnston CLA 2021-06-23 17:32:38 EDT
Released for 4.21 M1
Comment 6 Jeff Johnston CLA 2021-07-06 14:54:31 EDT
Verified for 4.21 M1 using I20210706-0600 build