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

“Pull Down Field” refactoring caused a change in the code behavior

Open
#1,738 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
1d 8h
Merged PRs (30d)
37

Description

Code before refactoring:
```java
class A extends C {
}

class B {
void main() {
final int b = 2;
new A() {
void m() {
System.out.println(b);
}
};
}
}
class C {
protected final int b = 1;
}
```
Code after refactoring:
```java
class A extends C {
protected final int b = 1;
}

class B {
void main() {
final int b = 2;
new A() {
void m() {
System.out.println(b);
}
};
}
}
class C {
}
```
The output before code refactoring is 1, and the output after refactoring is 2. The code behavior has changed.

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported example with Eclipse JDT UI's “Pull Down Field” refactoring and compare the output before and after. Start at the Pull Down Field refactoring entry point and verify that the anonymous subclass still resolves the field as 1 after refactoring; done means the refactoring preserves the original behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
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.