vscode-java
vscode-java copied to clipboard
Renaming methods causes code behavior to change
[provide a description of the issue]
Environment
Operating System: Windows11 JDK version: 17 Visual Studio Code version: 1.88 Java extension version: 1.29
Steps To Reproduce
- select "k()"
- click "Refactor-Rename"
- new method name "m()"
In this example, before the rename, the f() method calls the m() method in the parent class, and after the rename, the f() method calls the method in the subclass renamed m(). The rename causes the code behavior to change, so it is a bug.
class A { void m(Object m){ System.out.println("A"); } } class B extends A{ // rename k to m void k(String m){ System.out.println("B"); } void f(){ m("1"); } }