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 250281

Summary: Comments in [java] switch statement inappropriately wrapping on reformat.
Product: editor Reporter: naquada
Component: Formatting & IndentationAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: Other   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: Export of Editor and Formatting prefs

Description naquada 2015-02-06 22:36:37 UTC
Created attachment 151872 [details]
Export of Editor and Formatting prefs

If you format this source (first listing) with menu Source -> Format, the result contains an inappropriate line break/wrap in the result with these options:
  Right Margin: 100
  Enable Comments Formatting: yes
  Format Block Comments: yes
  Add Leading Star: yes
  Wrap Text at Right Margin: yes
  Wrap One Line Comments: no
  Preserve New Lines: yes

I've attached an export of the Editor and Formatting preferences.

---------------------------------------------------------------------------
public class SwitchFormat
{
  public void fn(int i)
  {
    switch (i) {
      case 1:
        /* In this case we want to do something that is associated with a value of 1 */
        break;
      default:
      /* Other stuff */
    }
  }
}
---------------------------------------------------------------------------
You get this:
---------------------------------------------------------------------------
public class SwitchFormat
{
  public void fn(int i)
  {
    switch (i) {
      case 1:
        /* In this
         * case we want to do something that is associated with a value of 1 */
        break;
      default:
      /* Other stuff */
    }
  }
}
---------------------------------------------------------------------------
Notice how the comment in "case 1" has wrapped, unnecessarily.