mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
extract class: constructor params (IDEA-73788 )
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
public class Extracted {
|
||||
private final Test test;
|
||||
String myT;
|
||||
|
||||
public Extracted(Test test) {
|
||||
this.test = test;
|
||||
this.myT = test.foo();
|
||||
}
|
||||
|
||||
void bar() {
|
||||
System.out.println(myT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
final Extracted extracted = new Extracted(this);
|
||||
|
||||
void bar(){
|
||||
extracted.bar();
|
||||
}
|
||||
|
||||
String foo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void bazz() {
|
||||
extracted.bar();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
String myT = foo();
|
||||
|
||||
void bar(){
|
||||
System.out.println(myT);
|
||||
}
|
||||
|
||||
String foo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void bazz() {
|
||||
bar();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class Extracted {
|
||||
String myT = "";
|
||||
|
||||
public Extracted() {
|
||||
}
|
||||
|
||||
void bar() {
|
||||
System.out.println(myT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
final Extracted extracted = new Extracted();
|
||||
|
||||
void bar(){
|
||||
extracted.bar();
|
||||
}
|
||||
|
||||
void foo() {
|
||||
extracted.bar();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
String myT = "";
|
||||
|
||||
void bar(){
|
||||
System.out.println(myT);
|
||||
}
|
||||
|
||||
void foo() {
|
||||
bar();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user