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

“Inline method” refactoring causes changes in calling relationships

Open
#1,748 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

Before the method is refactored, the m() method of the parent class is called. After the refactoring, the m() method of the child class is called. The calling relationship changes.
Code before refactoring:
```java

class A {
void m(Object m) {
System.out.println("A");
}
// inline method 'test()'
void test() {
m("1");
}
}

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

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

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

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

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the Java snippets in the report and the Inline Method refactoring. Trace how method resolution changes when test() is inlined into the subclass, then verify that the refactoring preserves the original calling relationship and that the example continues to dispatch to A.m(Object).

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.