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 258707 - Adjacent comments are reformatted improperly
Summary: Adjacent comments are reformatted improperly
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-07 15:31 UTC by naquada
Modified: 2016-04-14 12:43 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Netbeans Options Export (128.82 KB, application/zip)
2016-04-07 15:31 UTC, naquada
Details
Source file (991 bytes, text/x-java)
2016-04-07 15:32 UTC, naquada
Details

Note You need to log in before you can comment on or make changes to this bug.
Description naquada 2016-04-07 15:31:05 UTC
Created attachment 159147 [details]
Netbeans Options Export

Adjacent comments are reformatted improperly.  The comments after the first in the group are wrapped unnecessarily and indented incorrectly.

Using this sample code (line length should be 100) and doing Source->Format, you can replicate the problem.  An export of editor settings has been attached, as well.

package junk;

public class AdjacentCommentBug
{
  public AdjacentCommentBug()
  {
    /*
     * After doing a Source->Format, the two groups of comments below are re-formatted improperly.
     * They have incorrect word wrapping and indentation (although the first line ine each group
     * remains correct). Based on the editor settings, (Right Margin = 100, Line Wrap = Off, 
     * Comments Add leading Star, Wrap Text at Right Margin, Preserve New Lines), I don't think
     * there should be any reformatting at all.
     */
    int foo = 0;
    /* This is the first of the adjacent comments */
    /* This is the second of the pair of comments that are formatted incorrectly */
    int bar = 0;
    /* =================================================================================== */
    /* ==================================== Banner Comment =============================== */
    /* =================================================================================== */
  }
}
Comment 1 naquada 2016-04-07 15:32:14 UTC
Created attachment 159149 [details]
Source file

This is the source file so you won't have to cut/paste from the desription
Comment 2 naquada 2016-04-07 15:33:32 UTC
This is how it looks after reformatting:  

package junk;

public class AdjacentCommentBug
{
  public AdjacentCommentBug()
  {
    /*
     * After doing a Source->Format, the two groups of comments below are re-formatted improperly.
     * They have incorrect word wrapping and indentation (although the first line ine each group
     * remains correct). Based on the editor settings, (Right Margin = 100, Line Wrap = Off,
     * Comments Add leading Star, Wrap Text at Right Margin, Preserve New Lines), I don't think
     * there should be any reformatting at all.
     */
    int foo = 0;
    /* This is the first of the adjacent comments */
 /* This is the second of the pair of comments
     * that are formatted incorrectly */
    int bar = 0;
    /* =================================================================================== */
 /* ====================================
     * Banner Comment =============================== */
 /* =================================================================================== */
  }
}
Comment 3 naquada 2016-04-07 15:34:38 UTC
Version/Platform information:


Product Version: NetBeans IDE 8.1 (Build 201510222201)
Updates: NetBeans IDE is updated to version NetBeans 8.1 Patch 1
Java: 1.8.0_74; Java HotSpot(TM) 64-Bit Server VM 25.74-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_74-b02
System: Linux version 4.4.3-300.fc23.x86_64 running on amd64; UTF-8; en_US (nb)