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

Bug 363459

Summary: [quick fix] Better quick fixes in case of unresolved type of field
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Bug Depends on: 363716    
Bug Blocks:    

Description Deepak Azad CLA 2011-11-10 07:07:25 EST
In the following snippet there are 4 compilation errors and all of them are "string cannot be resolved to a type"
----------------------------------------------
class A
{
    private string name;  
    
    public void m1() { 
        String temp = name; 
    }
    
    public void m2() { 
        name = "Hello World"; 
    }
    
    public String m3() { 
        return name;  // quick fix here
    }
}
---------------------------------------------

When quick fix is invoked in m3(), you get a long list of proposals, including several "Change to 'XXXX'" proposals. However, the correct one "Change 'string' to 'String'" is missing. It should be possible to find the correct type in this case by looking at all the places where 'name' is used and figuring out the expected type in those locations.
Comment 1 Deepak Azad CLA 2011-11-10 07:11:07 EST
Note that when quick fix is invoked on the declaration "private string name;" the right quick fix "Change to 'String'" is there but is present somewhere in the middle of a long list.
Comment 2 Markus Keller CLA 2011-11-14 11:14:26 EST
Yeah, we should

a) improve priority of the "right" fix at the declaration of name

b) fix the quick fix at the other 3 locations so that it doesn't try to fix 'name'. I've filed bug 363716 for better compile errors here. For IProblem.MissingTypeInMethod, IProblem.MissingTypeInField, etc., we should just have a quick fix to jump to the declaration of the method/field/constructor. That would also work if the field/return type is e.g. java.util.List<string>.
Comment 3 Eclipse Genie CLA 2019-09-17 13:44:24 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.