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)