netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Rename array-typed variable may breaks code

Open makiam opened this issue 2 years ago • 2 comments

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

makiam avatar Oct 10 '22 16:10 makiam

This issue is a copy of https://issues.apache.org/jira/browse/NETBEANS-4355

makiam avatar Oct 10 '22 16:10 makiam

Confirmed. First workaround, use inline renaming with CTRL-R; second workaround, use idiomatic syntax String[]. :wink:

neilcsmith-net avatar Oct 11 '22 13:10 neilcsmith-net