netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Bug:Renaming a Field Name Causes Assignment Statements to Change

Open assdfsdafasfa opened this issue 1 year ago • 0 comments

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

assdfsdafasfa avatar Oct 08 '24 13:10 assdfsdafasfa