assdfsdafasfa opened a new issue, #8305:
URL: https://github.com/apache/netbeans/issues/8305
### Apache NetBeans version
Apache NetBeans 25
### What happened
Refactoring extraction methods leads to changes in code behavior
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
Select the method to see the output statement in (), select Extract Method
Refactoring, the new method name is m, resulting in a change in the calling
relationship. Before refactoring, f() calls the method in class A. After
refactoring, f() calls the m() method in class B.
Code before refactoring:
```java
class A {
void m(Object m) {
System.out.println("A");
}
}
class B extends A {
void k() {
String s=null;
//extract statements, new method name is ‘m()’
System.out.println(s);
}
void f() {
m("1");
}
}
```
Code after refactoring:
```java
class A {
void m(Object m) {
System.out.println("A");
}
}
class B extends A {
void k() {
String s=null;
//extract statements, new method name is ‘m()’
m(s);
}
private static void m(String s) {
System.out.println(s);
}
void f() {
m("1");
}
}
```
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
window11
### JDK
17
### Apache NetBeans packaging
Apache NetBeans platform
### Anything else
_No response_
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists