Bug 32022 - Indirect static proposal: Wrong compiler positions
Summary: Indirect static proposal: Wrong compiler positions
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-17 11:32 EST by Ioann Stellerex CLA
Modified: 2003-12-17 11:21 EST (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 Ioann Stellerex CLA 2003-02-17 11:32:30 EST
QuickFix produce wrong code while trying to fix the way class accesses field of 
the static member of the static class instance, i.e.:




instance.staticField.flag = true;


Where "instance" is the static field of the same class as caller, "staticField" 
its static member (instance of inner class StaticField) and the "flag" is a 
public field.


Code is a bit meaningless, but there is no matter.




Using QuickFix results in:




StaticField.flag = true;


while should be:




InstanceClass.staticField.flag = true;


or


staticField.flag = true;
Comment 1 Dirk Baeumer CLA 2003-02-17 13:05:05 EST
Time permitted for 2.1 since this is not a common case.
Comment 2 Martin Aeschlimann CLA 2003-12-04 12:38:08 EST
A problem is that the compiler highlights to much code. It should only highlight
'instance.staticField'; it currently does: instance.staticField.flag

I fixed the quick fix with a temporary fix that uses the problem arguments
(which I try to avoid as they are not really specified). It would be better to
fix it in the compiler.

public class E {
public void foo(ConstClass instance) {
        instance.staticField.flag= true;
    }
}
public class ConstClass {
    public static StaticField staticField = new StaticField();
}
public class StaticField {
    public boolean flag;
}


Comment 3 Philipe Mulet CLA 2003-12-04 15:36:52 EST
We should now be highlighting the proper portion of the qualified name.
Comment 4 Kent Johnson CLA 2003-12-05 13:11:02 EST
Fixed.
Comment 5 David Audel CLA 2003-12-17 11:21:27 EST
Verified for 3.0M6