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.
NetBeans preferences allows to set only continuation indentation size. There is a code style in JDK project that the continuation indentation for constructor or method arguments should be below open '(' bracket. For example: java.awt.GraphicsConfiguration class: ----------------- public BufferedImage createCompatibleImage(int width, int height, int transparency) { ----------------- The argument which is printed on new line is placed under the '(' bracket. Could this option be added to the NetBeans settings?
Found an example in Code Conventions for the Java Programming Language: http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-136091.html#248 Following are two examples of indenting method declarations. The first is the conventional case. The second would shift the second and third lines to the far right if it used conventional indentation, so instead it indents only 8 spaces. //CONVENTIONAL INDENTATION someMethod(int anArg, Object anotherArg, String yetAnotherArg, Object andStillAnother) { ... } //INDENT 8 SPACES TO AVOID VERY DEEP INDENTS private static synchronized horkingLongMethodName(int anArg, Object anotherArg, String yetAnotherArg, Object andStillAnother) { ... } The request for this enhancement is for the first case.
FWIW, I would recommend the following each-parameter-on-its-own-line indentation style for long parameter lists, which works fine with the current NB feature set and is always very readable: public void someMethod( int anArg, Object anotherArg, String yetAnotherArg, Object andStillAnother) { ... }
new Java Style Guidelines (Draft) also describes the requested indentation as one of possible options: http://cr.openjdk.java.net/~alundblad/styleguide/ Variant 1: With 8 extra spaces relative to the indentation of the previous line. Variant 2: With 8 extra spaces relative to the starting column of the wrapped expression. Variant 3: Aligned with previous sibling expression (as long as it is clear that itβs a continuation line) Variant 4: Aligned with previous method call in a chained expression. -------------- // Variant 3 int anInteger = aMethod(thatTakes, aLongList, ofArguments); -------------- It would be good if NetBeans supports all of them. The reason that I ask to add this option is because it is required indentation convention in java 2D team which we need to follow in review process. For example see java.awt.Graphics class: http://hg.openjdk.java.net/jdk9/client/jdk/file/fe8df8e55825/src/java.desktop/share/classes/java/awt/Graphics.java ---------------- public abstract boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer); ----------------