mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-171134 Extract as method object generates the same getters
This commit is contained in:
+10
@@ -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);
|
||||
}
|
||||
}
|
||||
+30
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user