extract class: constructor params (IDEA-73788 )

This commit is contained in:
anna
2011-12-06 14:20:26 +01:00
parent a49bf3f129
commit 55611fe9ad
8 changed files with 83 additions and 21 deletions

View File

@@ -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);
}
}

View File

@@ -0,0 +1,15 @@
class Test {
final Extracted extracted = new Extracted(this);
void bar(){
extracted.bar();
}
String foo() {
return "";
}
void bazz() {
extracted.bar();
}
}

View File

@@ -0,0 +1,15 @@
class Test {
String myT = foo();
void bar(){
System.out.println(myT);
}
String foo() {
return "";
}
void bazz() {
bar();
}
}

View File

@@ -0,0 +1,10 @@
public class Extracted {
String myT = "";
public Extracted() {
}
void bar() {
System.out.println(myT);
}
}

View File

@@ -0,0 +1,11 @@
class Test {
final Extracted extracted = new Extracted();
void bar(){
extracted.bar();
}
void foo() {
extracted.bar();
}
}

View File

@@ -0,0 +1,11 @@
class Test {
String myT = "";
void bar(){
System.out.println(myT);
}
void foo() {
bar();
}
}