apache / apache/netbeans

Rename array-typed variable may breaks code

Open
#4,765 2 comments 0 reactions 0 assignees View on GitHub
Contribution welcome Java kind:bug
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans latest daily build

### What happened

In case I have two array typed variables and I want rename one of them the second one unexpected changes type and this gives error

### How to reproduce

in some java class define two array-typed fields ex...
>> private String arrayOne[], arrayTwo[];
invoke rename command for first field ex to arrayOneRenamed
after rename code changes to
>> String[] arrayOneRenamed, arrayTwo[];
which is unexpected changes the second field type

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 10

### JDK

JDK 18.0.2

### Apache NetBeans packaging

Own source build

### Anything else

_No response_

### Are you willing to submit a pull request?

No

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Reproduce the problem in a Java class containing the two array-typed fields shown in the issue, then start from the rename command and trace the affected refactoring behavior. Done means renaming arrayOne leaves arrayTwo's type unchanged and the resulting source remains valid; add or run a regression check for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.