eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

“Move method refactoring” causes the method call relationship to change

Open
#1,865 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
23h 30m
Merged PRs (30d)
35

Description

Select the m() method in class C, select the move method refactoring, move it to class B, before refactoring, the f() method calls the m() method of class A, after refactoring, the f() method calls the m() method of class B。

Code before refactoring:
```java
class A {
void m(Object m) {
System.out.println("A");
}
}

class B extends A {
void k(String m) {
System.out.println("B");
}

void f() {
m("1");
}
}

class C {
B b;
// move m() to class B
void m(String m) {
System.out.println("B");
}
}
```
Code after refactoring:
```java
class A {
void m(Object m) {
System.out.println("A");
}
}

class B extends A {
void k(String m) {
System.out.println("B");
}

void f() {
m("1");
}

// move m() to class B
void m(String m) {
System.out.println("B");
}
}

class C {
B b;
}
```

Expected result (correct result):Give an error prompt before executing the refactoring

Contributor guide

Open the contributing guide

Research direction

Reproduce the refactoring in Eclipse JDT UI with the Java example from the issue: move C.m(String) to B while B inherits A.m(Object). Check whether the refactoring detects the changed method binding before execution. Done means the operation is prevented with an error prompt instead of producing the shown result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.