History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEABKL-2976
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Maxim Shafirov
Reporter: Vincent Mallet
Votes: 1
Watchers: 1
Available Workflow Actions

Mark as Stalled
Operations

If you were logged in you would be able to see more operations.
IDEA: Backlog

Create Getter intention should be smarter about return type

Created: 30 May 05 03:39   Updated: 30 May 05 17:21
Component/s: Editor. Intention Actions
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 3,341


 Description  « Hide
The "Create Getter" intention should be smarter about the return type when the field the getter is being created for already exists.

Given the code:

class Bar { private Bar bar; }

void foo(Bar bar) { System.err.println("bar: " + bar.getBar()); }

Using "Create getter" on "getBar()" and accepting the default type (String in that case) results in the uncompilable method in Bar:
public String getBar() { return bar; }
(Note that "Bar" is not an option in the proposed return types.)

Because the "bar" field already exists in Bar and we're creating a getter, the return type should be "Bar" (and not a choice of String, int, boolean, etc)



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.