Bug 427180

Summary: When generating method stubs to implement an abstract class/interface, option to generate fields for getters/setters
Product: [Eclipse Project] JDT Reporter: jules <jules>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3    
Version: 4.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description jules CLA 2014-02-01 02:12:00 EST
There are a handful of cases where eclipse will automatically generate a number of method stubs at once.  The ones I can think of right now are:

* Creating a new class that extends an abstract class or implements an interface with the appropriate checkbox for the behaviour checked
* As a 'quick fix' to an unimplemented abstract method error

There may be others that I'm not aware of.

When performing this operation, it would be useful if there was an option to recognise getter & setter methods and generate an appropriate field and stub implementation for them.  So, for example, instead of generating this code:

    @Override
    public void setSynonymManager (SynonymManager synonymManager)
    {
	    // TODO Auto-generated method stub
	    
    }

it would generate this code:

    private SynonymManager synonymManager;
    @Override
    public void setSynonymManager (SynonymManager synonymManager)
    {
	    // TODO Auto-generated method stub
	    this.synonymManager = synonymManager;
    }

(with both field and method body sorted to an appropriate place in the class)

I'm aware that this can currently be done quite quickly using content assist with the cursor in the parameter name for each method, but when there are a large number of such methods in an interface it would be a real help to be able to do this automatically.
Comment 1 jules CLA 2014-02-01 14:33:46 EST
Ignore me.  This appears to be a duplicate of bug 405455

*** This bug has been marked as a duplicate of bug 405455 ***