This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271508 - Specific Organize Members settings and code produces compile-time errors
Summary: Specific Organize Members settings and code produces compile-time errors
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.1
Hardware: PC Windows 10 x64
: P2 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2017-09-21 22:30 UTC by SunnyBat
Modified: 2017-09-21 22:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:

Examples of the issue (1.91 KB, text/plain)
2017-09-21 22:30 UTC, SunnyBat

Note You need to log in before you can comment on or make changes to this bug.
Description SunnyBat 2017-09-21 22:30:19 UTC
Created attachment 165158 [details]
Examples of the issue

When the "Sort Members in Groups Alphabetically" option is enabled, specific code can cause invalid formatting (compile-time errors) upon running Organize Members. Tested with Java.

- Sort alphabetically must be enabled
- You must have more than one variable declared on a single line
- You must have another variable on a different line that will be organized between your single-line variables

I've attached a .txt file with multiple examples.

This has several different results depending on how the code is organized before Organize Members is run. I get different outputs depending on where obj2 and second2 are in relation to their obviously-related variables as well as in relation to each other. For example, you get different results if second2 is declared after second1. You also get different results for obj1 if second2 is declare before obj1. It's very weird behavior.

The problem seems to stem from NetBeans not properly recognizing comma-separated variable formatting. NetBeans will either use a comma instead of a semicolon for the first variable, or NetBeans will declare the first variable a second time when declaring the third variable.

This also happens when using more than three variables.

Issue set at P2 due to needing to manually correct issues after Organize Members is run.

Tested with NetBeans 8.1, Windows 10, JDK8u91, all 64-bit.