redhat-developer / redhat-developer/vscode-java

Renaming methods causes code behavior to change

オープン
#3,705 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

[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
  1. select "k()"
  2. click "Refactor-Rename"
  3. 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");
}
}

Current Result:

image

Expected Result: A warning is given during the refactoring process that the name may cause the refactoring behavior to change
Additional Informations

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供された Java クラス、Windows 11、JDK 17、VS Code 1.88、Java extension 1.29 を使用して、Refactor-Rename フローで問題を再現します。k から m への名前変更が f() 内の呼び出しにどのような影響を与えるかを追跡し、その後、メソッド解決が変わる可能性がある場合にリファクタリングが警告することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
developer-experience
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。