eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
Bug: Renaming a method causes changes in other unrelated methods
- Dominant language
- Java
- Stars
- 59
- Forks
- 127
- Avg merge
- 22h 47m
- Merged PRs (30d)
- 28
Description
- In the example below, when selecting **m(**) within **super.m()**, **Refactor**, **Rename**.
```jsx
interface TestInterface {
void m(String argument);
}
class TestClass {
void m(String argument) {}
}
class MyClass extends TestClass implements TestInterface {
@Override
public void m(String argument) {
super.m(argument); // rename m to n
}
}
```
The result after performing the renaming:
```jsx
interface TestInterface {
void n(String argument); // Rename change
}
class TestClass {
void n(String argument) { // Rename change
}
}
class MyClass extends TestClass implements TestInterface {
@Override
public void n(String argument) { // Rename change
super.n(argument); // Rename change
}
}
```
From the result, it can be seen that the refactoring performed four renaming changes. Due to the feature of the **super** keyword, when renaming the **super.m()** method, it is only necessary to change **m()** with **super.m()** and the **m()** method in the parent class(**TestClass.m()**).
Contributor guide
Assessment
This issue has not been assessed yet.