Closed tsdh closed 9 years ago
Oh sorry, in my version the program looks a bit different. I've pushed the wrong version.
It should be:
// ChildClass1.java
public class ChildClass1 extends ParentClass {
String field = "I am a field";
public static void main(String[] args) {
ChildClass1 c = new ChildClass1();
System.out.println("Field: "+c.field);
System.out.print("Method: ");
c.method();
}
public void method(){
System.out.println("Hello World!"+c);
}
}
// ChildClass2.java
public class ChildClass2 extends ParentClass {
public void method(){
System.out.println("Hello World!"+"I am a field");
}
}
The field access got lost.
Ok, then it makes sense.
Does this case now work as expected?
Yes, so I'm closing this issue.
This refactoring tries
applyPullUpMethod(hidden.program.one.ParentClass, method)
.ParentClass
has two subclasses:There is no way for a solution to see that these two
method()
definitions aren't equivalent. They both have the same signature and access only the same methodPrintStream.println()
. So to my best understanding,method()
is pullable.