Whenever an expression that uses curly braces is typed
within an enclosing set of parentheses (e.g. passing a
statically defined array to a method) and that
expression is not the final argument passed to the
method, then any following lines are indented too far
which is a problem.
Simple example that uses an array initializer in a method call
Logged In: YES
user_id=430590
I tried to reproduce this bug in DrJava 20030724 with the
attached simple example but I failed. Has this bug been
fixed by recent improvements to the indenting algorithm? Or
is my example to simple to exhibit the problem?
Logged In: YES
user_id=557360
The bug occurs when the expression in curly braces is not
the final argument but is the last argument on its line.
Here's an example:
class Indent {
..int foo(int[] a, int b, int c) { return a[0]; }
..int fooTest() {
....int result = foo(new int[] {-17, 12},
..............................6,
..............................5);
..............................System.out.println(result);
..............................return result;
..}
}
As you can see, every line after the ill-fated method call
before the next close brace is indented too far to the
right. The workaround is to make sure that the expression in
curly braces is immediately followed by the next argument.
They have to be on the same line.
For example, in this case:
int result = foo(new int[] {-17, 12}, 6,
..........................5);
will not exhibit the bad behavior.
We're putting indent bugs on hold for now as we try to
prepare another stable release before school starts with
some bug fixes and new features.