mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
pull up: move field initialization block if possible (IDEADEV-40576)
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
public class A {
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String <caret>f;
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
this.foo = foo;
|
||||
if (fi == this.foo) {
|
||||
f = foo;
|
||||
} else {
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
public class A {
|
||||
final String f;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
this.foo = foo;
|
||||
if (fi == this.foo) {
|
||||
f = foo;
|
||||
} else {
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
public class A {
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String <caret>f;
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
this.foo = foo;
|
||||
if (fi == foo) {
|
||||
f = foo;
|
||||
} else {
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
public class A {
|
||||
final String f;
|
||||
|
||||
public A(String foo, String fi) {
|
||||
if (fi == foo) {
|
||||
f = foo;
|
||||
} else {
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
super(foo, fi);
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
public class A {
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String <caret>f;
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
this.foo = foo;
|
||||
f = "";
|
||||
}
|
||||
|
||||
B(String foo) {
|
||||
this.foo = foo;
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
public class A {
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String <caret>f;
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
this.foo = foo;
|
||||
if (fi == this.foo) {
|
||||
f = foo;
|
||||
} else {
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
|
||||
B(String f) {
|
||||
this.f = f;
|
||||
foo = "";
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
public class A {
|
||||
final String f;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
this.foo = foo;
|
||||
if (fi == this.foo) {
|
||||
f = foo;
|
||||
} else {
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
|
||||
B(String f) {
|
||||
this.f = f;
|
||||
foo = "";
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
public class A {
|
||||
final String f;
|
||||
|
||||
public A() {
|
||||
f = "";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final String foo;
|
||||
|
||||
B(String fi, String foo) {
|
||||
super();
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
B(String foo) {
|
||||
super();
|
||||
this.foo = foo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
public class Sup {
|
||||
|
||||
}
|
||||
|
||||
class ExtractSuperClass extends Sup {
|
||||
|
||||
private final String <caret>field;
|
||||
|
||||
public ExtractSuperClass() {
|
||||
|
||||
|
||||
try {
|
||||
field = (String)"text";
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
public class Sup {
|
||||
|
||||
protected final String field;
|
||||
|
||||
public Sup() {
|
||||
try {
|
||||
field = (String)"text";
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ExtractSuperClass extends Sup {
|
||||
|
||||
public ExtractSuperClass() {
|
||||
super();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user