Renaming Local Variables Leads to Changes in Code Behavior
- 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 "variabeToBeRenamed" is selected for the rename variable refactoring, code before refactoring, "variable" variable assigned to "fieldToBeRenamed" field;
class SourceClass{
int variableToBeRenamed = 1;
class InnerClass{
int field = 0;
void method(){
field = variableToBeRenamed ;
}
}
}
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
When the "variabeToBeRenamed" is selected for the rename variable refactoring, code before refactoring, "variable" variable assigned to "fieldToBeRenamed" field;
class SourceClass{
int variableToBeRenamed = 1;
class InnerClass{
int field = 0;
void method(){
field = variableToBeRenamed ;
}
}
}
### 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
Start by reproducing the rename-variable refactoring in Apache NetBeans 23 with the supplied nested-class Java example. Compare the assignment before and after renaming variableToBeRenamed; done means the refactoring preserves the assignment to the intended field and includes a regression test for this case.
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
- 35/100