Bug 427180 - When generating method stubs to implement an abstract class/interface, option to generate fields for getters/setters
Summary: When generating method stubs to implement an abstract class/interface, option...
Status: CLOSED DUPLICATE of bug 405455
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-01 02:12 EST by jules CLA
Modified: 2014-02-01 14:33 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***