Community
Participate
Working Groups
Using 1008, the NullPointerException should be indented one more time. public class X { void foo() throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.NullPointerException { } }
should use compact shift indent alignment
I get this: public class X { void foo() throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.NullPointerException { } } I think it makes more sense to remove the alignment on the throws and let the exceptions being aligned on the next line. So we would get: public class X { void foo() throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.NullPointerException { } } Jindent formats it like that: public class X { void foo() throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.NullPointerException {} } Do we want something similar?
Open attached file to see the latest result. I prefer this solution. JIndent is quite inconsistent for the throw clause alignment and I didn't find any specific details on this in the Sun conventions.
Created attachment 6949 [details] Latest result
Wondering if the #throws clause shouldn't remain on the same line ? This is why I thought the compact shift indent would do the trick... public class X { void foo() throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.NullPointerException { } }
If the line then gets too long, it should then try to format as described in comment #4.
The problem is that the "throws" keyword is part of the alignment. Then as soon as you split, throws moves to the next line. I don't see how to keep throws on the first line.
I was not using the right alignment. Now I get: public class X { void foo() throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.NullPointerException { } } Consider as fixed. Regression test added. Reopen if it is not working as expected. I am not doing any split between the throws and the first exception name. This prevents from having throws at the end of the line.
Verified for 3.0M6