Renaming a field can cause the code behavior to change
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 22
### What happened
When the "fieldToRename" field is selected for the rename field refactoring, it causes a refactoring bug because the new field name being renamed conflicts with other variables in the inner class, resulting in a change in code behavior.
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
1. select 'fieldToREname'
2. rename 'fieldToREname' to 'newVariable'

In this example, a variable is assigned to a field before refactoring, and when the field is renamed to a variable name, the assignment statement becomes an assignment to the field itself, resulting in a change in code behavior
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Windows11
### JDK
20
### Apache NetBeans packaging
Apache NetBeans platform
### Anything else
_No response_
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Start by reproducing the issue in Apache NetBeans 22 on Windows 11 with JDK 20, using the described field-to-variable rename inside an inner class. Trace the rename field refactoring and verify that the resulting assignment still targets the intended variable rather than changing program 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
- 35/100