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 234976 - Formatting >> Java Comments: "Add Leading Star" without "Format Block Comment"
Summary: Formatting >> Java Comments: "Add Leading Star" without "Format Block Comment"
Status: REOPENED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal with 3 votes (vote)
Assignee: Dusan Balek
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2013-08-25 19:53 UTC by MackSix
Modified: 2014-07-30 23:11 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-08-25 19:53:49 UTC
1. Goto Tools >> Options >> Formatting >> Languages: Java, Category: Comments. The option "Add Leading Star" should be checked and "Format Block Comments" should be unchecked.

2. Type /* and press Enter

Results:  /*

          */

Expected: /*
           *
           */


This works in NetBeans 7.3.1.

Product Version: NetBeans IDE Dev (Build 201308240953)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b55
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b40
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Dusan Balek 2013-08-26 11:08:52 UTC
Current behavior is as designed. Block comment formatting settings should be respected - when "Format Block Comments" is unchecked, no formatting of block comments should be done - including adding of leading star.
Comment 2 MackSix 2013-08-26 21:56:21 UTC
Leading stars has _always_ worked in 7.2 and 7.3 and the preview in 7.4 shows leading stars without formatting blocks. 

Is there a workaround so that I can have automatic leading stars and not have format messing up code that I have in comments?

I will be happy to open or change this to an ENHANCEMENT or maybe there is a better solution to have formatted comments while avoiding format of code in comments?
Comment 3 MackSix 2013-08-26 22:07:37 UTC
Here is what I mean, with block formatting on I get auto-leading stars, but if I format this:

    /*
     * public void test(int[] array) {
     *    for (int i = 0; i < array.length; i++) {
     *        int j = array[i];
     *    }
     * }
     */

I get this:

    /*
     * public void test(int[] array) { for (int i = 0; i < array.length; i++) {
     * int j = array[i]; } }
     */

Which is a problem for me. If I disable formatting blocks, it won't do this, but then I can't easily type block comments with auto-leading stars.
Comment 4 MackSix 2013-08-26 22:13:17 UTC
Anyway, I think it should behave like it does now too, for consistency in the options, so I think what I need should be an additional option so it's clear that the option only adds leading star. Or an option that prevents code in blocks from being formatted while block comment formating is enabled.
Comment 5 MackSix 2013-08-26 22:29:02 UTC
Changed to ENHANCEMENT
Comment 6 fscherrer 2014-07-30 23:11:11 UTC
So, anybody got a workaround?