Bug:Renaming a Field Name Causes Assignment Statements to Change
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 23
### What happened
When the "fieldToBeRenamed" field is selected for the rename field refactoring, code before refactoring, "variable" variable assigned to "fieldToBeRenamed" field; Code after refactoring, "variable" variable assigned to itself, resulting in a change in code behavior.
class SourceClass{
public void method(){
int variable =0;
class InnerClass{
int fieldToBeRenamed;
public void method2(){
fieldToBeRenamed = variable;
}
}
}
}
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
When the "fieldToBeRenamed" field is selected for the rename field refactoring, code before refactoring, "variable" variable assigned to "fieldToBeRenamed" field; Code after refactoring, "variable" variable assigned to itself, resulting in a change in code behavior.
class SourceClass{
public void method(){
int variable =0;
class InnerClass{
int fieldToBeRenamed;
public void method2(){
fieldToBeRenamed = variable;
}
}
}
}
### Did this work correctly in an earlier version?
Apache NetBeans 23
### Operating System
Windows11
### JDK
20
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
No source file or test is named. Start at the field rename refactoring entry point and reproduce the nested-class example in Apache NetBeans 23; done means renaming fieldToBeRenamed preserves the assignment of variable to the renamed field rather than changing it to a self-assignment.
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
- 42/100