Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming fields causes conflicts with variable naming, resulting in changes in code behavior #3615

Open
DongChunHao opened this issue Apr 25, 2024 · 2 comments

Comments

@DongChunHao
Copy link

[provide a description of the issue]

Environment
  • Operating System:
  • JDK version:
  • Visual Studio Code version:
  • Java extension version:
Steps To Reproduce

1.select "originalField"
2.click “Rename”
3. new name "originalFieldRenamed"

class MyClass {
// rename "originalField" to "originalFieldRenamed"
private final int originalField = 10;
protected int protectedField;

public void myMethod() {
int originalFieldRenamed = 20; // Local variable with the same name as the field
System.out.println(originalField);
}
}
refactoring result:
image

Copy link

We have found issues that are potential duplicates:

If any of the issues listed above are a duplicate, please consider closing this issue & upvoting/commenting the original one.
Alternatively, if neither of the listed issues addresses your feature/bug, keep this issue open.

@gtn1024
Copy link

gtn1024 commented Apr 29, 2024

It seems IntelliJ have the same behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants