Bug 203965 - Sort members incorrect sorts dependant variables
Summary: Sort members incorrect sorts dependant variables
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-19 09:01 EDT by Brian Curnow CLA
Modified: 2007-10-29 07:15 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 Brian Curnow CLA 2007-09-19 09:01:17 EDT
A class defined like this:

public class Good {
    private static final String B = "This is a" + A;
    private static final String A = " test";
}

(which doesn't compile) 

Will be correct sorted to:

public class Good {
    private static final String A = " test";
    private static final String B = "This is a" + A;
}

Because the variables are sorted in alphabetic order, however, the class:

public class Bad {

    private static final String B = " test";
    private static final String A = "This is a" + B;
}

(which does compile)

Will be incorrectly sorted to:

public class Bad {

    private static final String A = "This is a" + B;
    private static final String B = " test";
}

(which *does not* compile)

Sort members should not simply sort the variable name but should also take into account the dependency between variables.
Comment 1 Jerome Lanneluc CLA 2007-09-19 09:45:40 EDT
Sort members only considers the source, no resolution is done (you need to resolve "B" to know that it binds to field B).
No plan to change this.
Comment 2 Frederic Fusier CLA 2007-10-29 07:15:02 EDT
Verified for 3.4M3 using I20071029-0010 build.