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

Bug 397153

Summary: [inline] Inline constant deletes the constant that is used in the constant definition
Product: [Eclipse Project] JDT Reporter: Milos Gligoric <milos.gligoric>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P4 CC: manju656, markus.kell.r, noopur_gupta
Version: 4.2.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Milos Gligoric CLA 2012-12-25 16:39:37 EST
Steps to reproduce:
1. See the instructions in code below
2. The resulting code does not compile

Related to bug 268968.
Build id: 20121114-2344

class C {
    C c = CONST;

    // Invoke "Inline Constant" on "CONST"
    private final static C CONST = new C() {
        Object m() {
            return CONST;
        }
    };
}
Comment 1 Martin Mathew CLA 2013-01-24 01:35:25 EST
Issue is reproducible using Build ID : I20130115-1300. The refcatoring results in compiler error.

This bug is almost related to bug 268968.
Comment 2 Markus Keller CLA 2013-11-26 12:48:12 EST
*** Bug 422566 has been marked as a duplicate of this bug. ***
Comment 3 Markus Keller CLA 2013-11-26 12:50:43 EST
Same problem with lambda expressions (bug 422566).

We shouldn't delete a constant whose initializer refers to the constant itself. This should trigger a non-fatal error and the constant should not be deleted.

Lowering priority, since I don't expect this happen frequently in practice.
Comment 4 Eclipse Genie CLA 2019-08-29 19:57:59 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.