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.
See the discussion in issue 72704. Basically, for EJB3, it is important that generated annotations in a [] element end up on different lines. It is quite unreadable on one long line.
Java team, are you planning to fix this issue in 5.5? We have a dependency on it which would be quite nice to fix. It is just cosmetic issue but it look pretty ugly if you have extremely long lines in generated code (and they can be REALLY long...). Thanks.
We do not plan to fix this, but if you will mark it as a blocker, we have to find solution for it. I agree it is ugly. I thought about possible solutions I found just two: 1) In our generator, this is the "normal" Array initializer, JavaCore does not solve, if it is inside annotation or not. We can add new line character between values, but this will affect all newly generation array initializers, i.e. if somebody will create array initializer with integer values, e.g. int[] array = { 0, 1, 2 }; this will be presented in roughly int[] array = { 0, 1, 2 }; IMO we can do this fix for release55, as I found just one usage of ArrayInitializationClass.createArrayInitialization() in our codebase and it is this one, yours.
2) reformat the generated code. This seems to be worse solution because text will probably "dance" in editor. To minimize an impact of solution 1), I can check that array initializer is in attribute value, i.e. refImmediateComposite() is an AttributeValue instance. Then, the possible problem with other array initializers will be eliminated. Unfortunately, both ways are hacks. JavaCore does know nothing about the line length. This should be solved by redesigning some parts of generator and editor has to provide some additional information. This is not planned in the future. I will prepare test patch for 1) and will attach it here.
Created attachment 30651 [details] Patch to trunk build
Any comments?
Bump - Pavel B., can you respond to whether or not you agree to the patch?
Sorry for not responding earlier. I agree with this solution. The patch looks good to me as far as I can tell from the code. Please apply to 5.5 so we can test and close 73269. Thanks both to Pavel and Rochelle.
Do we need some keywords here to make sure it gets integrated into 5.5? Pavel B. added comments that it should several weeks ago...
Dane, please merge this into 5.5. Thanks!
Patch applied on trunk, I will merge it into release55 branch tomorrow. /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ArrayInitializationImpl.java new revision: 1.10; previous revision: 1.9
Fix merged into release55. /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ArrayInitializationImpl.java new revision: 1.5.26.1.2.4; previous revision: 1.5.26.1.2.3
Reorganization of java component