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 212248 - [72cat] Matisse code formatter don't respect formatting settings
Summary: [72cat] Matisse code formatter don't respect formatting settings
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Jan Lahoda
: 210444 (view as bug list)
Depends on:
Reported: 2012-05-09 15:09 UTC by Michel Graciano
Modified: 2012-06-10 19:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Sample form (1.97 KB, application/zip)
2012-05-09 17:44 UTC, Michel Graciano
Same sample, but now edited at 7.1 (2.00 KB, application/zip)
2012-05-09 17:47 UTC, Michel Graciano
Sample project to reproduce (8.86 MB, application/zip)
2012-05-09 19:04 UTC, Michel Graciano

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2012-05-09 15:09:20 UTC
[ BUILD # : bc77094b1af6 ]
[ JDK VERSION : 1.7.4 ]

The Matisse code formatter should respect the project/IDE code formatting
settings. It should work as 7.1 usually does. I really think it was already
filed but I couldn't find it so I am filing this anyway. It should be fixed for
Comment 1 Michel Graciano 2012-05-09 15:10:34 UTC
To keep the diffs between changes in a good shape, I was forced to go back to 7.1 since I am the only one in the team working with 7.2.
Comment 2 Jan Stola 2012-05-09 15:26:20 UTC
Please, provide exact steps to reproduce. Do not forget to emphasize the difference between the actual and expected behavior.
Comment 3 Michel Graciano 2012-05-09 16:47:42 UTC
I will work on that. I am facing problems to reproduce the issue with a clean form but I can reproduce it without any problem with some forms from our internal project. I will try to extract the problem to a simple use case and will put it here asap.
Comment 4 Michel Graciano 2012-05-09 17:34:39 UTC
It looks to be related to some configuration at out internal project. i have already transplanted the formatting configurations to a sample project without success. Any idea whatever could be messing up the code generation? I can reproduce it with any form at our project, but not outside it. This is a huge project, so I can't share it right now.
Comment 5 Michel Graciano 2012-05-09 17:44:45 UTC
Created attachment 119230 [details]
Sample form

It is just a sample form. Take a look at line 77, how long it is generated. I couldn't create a sample project you with a reproducible case yet. Could you take a look?
Comment 6 Michel Graciano 2012-05-09 17:47:16 UTC
Created attachment 119231 [details]
Same sample, but now edited at 7.1

This is the exactly same form, I have just opened it at 7.1 and made some little change to force the code to be regenerated. Now you can see the difference. Both samples was extracted from same project.
Comment 7 Michel Graciano 2012-05-09 19:04:20 UTC
Created attachment 119234 [details]
Sample project to reproduce

The problem maybe is a dup of #210039. I have create 2 forms which I can reproduce the issue at 7.2 and 1 where it works. NB72_Error1 and NB72_Error2 the problem is present, and NB72_Working it is working. You can see that the only difference is related to initComponents comments and/or annotations.

To reproduce the problem, just open the NB72_Error1 and/or NB72_Error2, edit some property, as jTextField1 text property and reload and save the form. You can see the code will be messed up. The 7,1 doesn't has this issues.
Comment 8 Michel Graciano 2012-05-09 19:06:35 UTC
IMHO it should be fixed at least for FCS. It wasn't easy to reproduce, took almost 5 hours. I hope you will be able to reproduce and fix it. As i said, it looks to be at least related to issue #210039.
Comment 9 Tomas Pavek 2012-05-10 16:55:53 UTC
This is related to the bug 210039 in that it also happens when the "Generate Full Classnames" setting is set off. But while bug 210039 is about cases where the FQN replacement does not work at all, this is about bad code formatting (when it works).

The code generated by the GUI builder, that is formatted correctly but contains FQNs, is "reworked" by the Java source infrastructure when replacing the FQNs by short names. The code that is produced is now no longer nicely formatted. NB 7.1 was able to keep the original formatting and do just minimum changes.

The described behavior can be seen on the given NB72_Error1 and NB72_Error2 forms. NB72_Working is actually not working, it exposes the bug 210039 where the FQN replacement does not happen at all.

As a workaround I recommend to switch the "Generate Full Classnames" to on (which is the default). It is faster and much less error-prone.
Comment 10 Michel Graciano 2012-05-10 17:07:16 UTC
Thanks for your evaluation Tomas. I have confirmed the workaround and it really worked as expected. I hope we can fix it for FCS because it is a stopper for our team, I am not really considering this workaround for production.
Comment 11 Quality Engineering 2012-05-15 10:11:21 UTC
Integrated into 'main-golden', will be available in build *201205150400* on (upload may still be in progress)
User: Jan Lahoda <>
Log: #212248: after ba0c76ff0c9f diffing of method invocations broke in some cases, trying to correct.
Comment 12 Michel Graciano 2012-05-15 12:54:02 UTC
I have tried it today and looks fixed to me. I am not sure if I should close it or you, so fell free to mark it as fixed.

I will keep testing it with other forms, but now it looks to be working.

v. Build 20120515-f0946721fb91
Comment 13 Jan Lahoda 2012-05-15 13:07:00 UTC
Sorry, I wrote a comment here, but it apparently was not committed to the bug (I was experiencing some network issues yesterday).

The above changeset should fix the problem, even though I am not quite sure what was wrong in the changeset that caused it (ba0c76ff0c9f).
Comment 14 Michel Graciano 2012-05-15 13:12:28 UTC
Thanks Jan.

v. Build 20120515-f0946721fb91
Comment 15 Jan Lahoda 2012-06-10 19:39:03 UTC
*** Bug 210444 has been marked as a duplicate of this bug. ***