Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 54587 - [quick fix] join variable declaration causes compile error
Summary: [quick fix] join variable declaration causes compile error
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-12 04:46 EST by Ilja Preuss CLA
Modified: 2005-04-27 07:03 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilja Preuss CLA 2004-03-12 04:46:25 EST
3.0M7

    int l;
    String s = "";
    l = s.length();
    System.out.println(l);

Do "join variable declaration" on l. This leads to the code

    int l = s.length();
    String s = "";
    System.out.println(l);

which has a compile time error. The correct code would be

    String s = "";
    int l = s.length();
    System.out.println(l);
Comment 1 Ilja Preuss CLA 2004-03-15 04:03:53 EST
In which way is this related to bug 54790 ???
Comment 2 Martin Aeschlimann CLA 2004-03-15 10:00:37 EST
removed dependency to bug 54790 
Comment 3 Martin Aeschlimann CLA 2005-04-27 05:40:42 EDT
I changed the 'Join variable' to honor the invocation point: On the variable
declaration the first assigment moves up to the declaration.
If invoked on the first assignment, the declaration is removed and goes down to
the assignment.

In both cases this can result in compile errors. To evaluate this, a deeper
analysis is required, mostly resulting in no real joining at all. I find it
better to leave the decition to the user. An undo is quickly performed.
Comment 4 Ilja Preuss CLA 2005-04-27 07:03:25 EDT
Sounds like a reasonable tradeoff. Thanks.