IDEA-171134 Extract as method object generates the same getters

This commit is contained in:
Egor.Ushakov
2017-04-07 15:21:09 +03:00
parent 46b5b7470c
commit e1f423e1d4
4 changed files with 78 additions and 9 deletions
@@ -0,0 +1,10 @@
public class SameFieldsWithPrefix {
public static void main(String[] args) {
<selection>int aValue = 100;
int bValue = 1000;
IntStream.of(aValue, bValue).peek(x -> {}).sum();</selection>
System.out.println(aValue + bValue);
}
}
@@ -0,0 +1,30 @@
public class SameFieldsWithPrefix {
public static void main(String[] args) {
Inner inner = new Inner().invoke();
int aValue = inner.getValue();
int bValue = inner.getBValue();
System.out.println(aValue + bValue);
}
private static class Inner {
private int myValue;
private int myBValue;
public int getValue() {
return myValue;
}
public int getBValue() {
return myBValue;
}
public Inner invoke() {
myValue = 100;
myBValue = 1000;
IntStream.of(myValue, myBValue).peek(x -> {}).sum();
return this;
}
}
}