When test() is selected to perform pull down refactoring into class A, before refactoring, test() method calls method() of class ParentClass, after refactoring, test() method calls method() of class SubClass, resulting in a change in code behavior.
Code before refactoring
class ParentClass {
void method() {
System.out.println("ParentClass method");
}
}
class A extends SubClass {
void method() {
System.out.println("Class A method");
}
}
class SubClass extends ParentClass {
void test() {
method();
}
}
Language / Project Type / NetBeans Component
No response
How to reproduce
When test() is selected to perform pull down refactoring into class A, before refactoring, test() method calls method() of class ParentClass, after refactoring, test() method calls method() of class SubClass, resulting in a change in code behavior.
Code before refactoring
class ParentClass {
void method() {
System.out.println("ParentClass method");
}
}
class A extends SubClass {
void method() {
System.out.println("Class A method");
}
}
class SubClass extends ParentClass {
void test() {
method();
}
}
Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows11
JDK
20
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
Code after refactoring
class ParentClass {
void method() {
System.out.println("ParentClass method");
}
}
class A extends SubClass {
void method() {
System.out.println("Class A method");
}
void test() {
method();
}
}
class SubClass extends ParentClass {
}
Apache NetBeans version
Apache NetBeans 23
What happened
When test() is selected to perform pull down refactoring into class A, before refactoring, test() method calls method() of class ParentClass, after refactoring, test() method calls method() of class SubClass, resulting in a change in code behavior.
Code before refactoring
Language / Project Type / NetBeans Component
No response
How to reproduce
When test() is selected to perform pull down refactoring into class A, before refactoring, test() method calls method() of class ParentClass, after refactoring, test() method calls method() of class SubClass, resulting in a change in code behavior.
Code before refactoring
Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows11
JDK
20
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
Code after refactoring
Are you willing to submit a pull request?
No