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 144924

Summary: Wrong source format (Alt+Shift+F) with preprocessor symbols
Product: java Reporter: divenvrsk <divenvrsk>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: RESOLVED WONTFIX    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: picture for description of the bug
picture for description of the bug

Description divenvrsk 2008-08-23 17:49:53 UTC
Hi,

I have some troubles with code autoformat with Source -> Format. When I use Alt+Shift+F with code where many preprocess 
symbols IDE can move defines (such as //#if TRALALA) to the end of the previous line. Not good.

For example:
 - before Alt+Shift+F we have:
  public static final int DIALOG_BORDER_SIZE = 2, 
            //#if ADJUST_DIALOG_BORDER_SPACE 
            //# DIALOG_BORDER_SPACE = Constant.DIALOG_BORDER_SPACE,
            //#else
            DIALOG_BORDER_SPACE = 8, 
            //#endif

 - and after Alt+Shift+F we have:
  public static final int DIALOG_BORDER_SIZE = 2, //#if ADJUST_DIALOG_BORDER_SPACE 
            //# DIALOG_BORDER_SPACE = Constant.DIALOG_BORDER_SPACE,
            //#else
             DIALOG_BORDER_SPACE = 8, //#endif
Comment 1 divenvrsk 2008-08-23 17:50:47 UTC
Created attachment 68163 [details]
picture for description of the bug
Comment 2 divenvrsk 2008-08-23 17:51:14 UTC
Created attachment 68164 [details]
picture for description of the bug
Comment 3 Vitezslav Stejskal 2008-08-25 11:06:03 UTC
I'm assuming that you are talking about C/C++ files...
Comment 4 Vladimir Voskresensky 2008-08-25 11:50:43 UTC
Sorry, it is not C++ code (public static final int)
May be mobility extension...
Comment 5 divenvrsk 2008-08-25 12:22:19 UTC
yep, it's J2ME.
any additional info?
Comment 6 Petr Suchomel 2008-09-04 13:06:32 UTC
It is in mobility, seems like editor indentation engine goes crazy on preprocessor syntax. Mobility is not involved in
formatting though.
Comment 7 Vitezslav Stejskal 2008-09-05 11:21:21 UTC
> It is in mobility, seems like editor indentation engine goes crazy on preprocessor syntax

No, it does not. You preprocessor syntax is basically a java line comment and it is formatted as such.

divenvrsk, does it make any difference if you define each constant explicitly with 'public static final int'? Thanks
Comment 8 Jan Becicka 2008-09-05 14:36:18 UTC
Reproducible.
Problem seems to be in fieldgroup formating. If fields are defined separately it works fine.
Comment 9 Jan Becicka 2008-11-13 09:29:37 UTC
Will resolve later.
Comment 10 Quality Engineering 2009-11-02 11:01:36 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX