Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pull Down Method Refactoring Bug] Pull down method refactoring leads to changes in code calling relationships #7800

Open
assdfsdafasfa opened this issue Sep 26, 2024 · 0 comments
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix needs:triage Requires attention from one of the committers

Comments

@assdfsdafasfa
Copy link

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

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 {
}

Are you willing to submit a pull request?

No

@assdfsdafasfa assdfsdafasfa added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Sep 26, 2024
@mbien mbien added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix needs:triage Requires attention from one of the committers
Projects
None yet
Development

No branches or pull requests

2 participants