Author Topic: Java Beautifier  (Read 2178 times)

Tree

  • Community Member
  • Posts: 79
  • Hero Points: 2
Java Beautifier
« on: May 02, 2013, 09:21:09 pm »
These options should be considered in the new beautifier for java: (or I just haven't found the options)

1) Beautifier needs to be able to do word wrap for long lines. (and similarly unwrap lines that don't need to be wrapped anymore)
2) Word wrap (and indent) should have an option for "align on parens except when that would push the line past the wrap boundary, in which case use continuation indent"
3) Multi-catch needs to allow a space between the exception names. This looks like it should use the rules for binary operators, but it doesn't. I.E. "catch (Exception1 | Exception2 | Exception3 e) {"
4) Enums with multiple values with brace blocks should have the comma on the same line as the closing brace, not on a line by itself.
5) Inline class definitions should not get a newline after the closing block. run() should be like this: (not on the following line)
  Foo foo = new Bar() {
      public Foo doStuff() { return newFoo;}
  }.run();
6) Function arguments and Constructor parameters should have separate configuration for continuation indent.
7) all statements are ending up in column 0 if they follow a line with a generic object. For example:
     Foo<? extends FooBar<?> > foo = null;


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1238
  • Hero Points: 119
Re: Java Beautifier
« Reply #1 on: May 03, 2013, 12:04:07 am »
(1) & (2)  Yeah, we do need to integrate that in the beautifiers.
(3) - Yes.  I think this is easily doable for the next drop.  I'm thinking it needs a separate setting.
(4) - ahh, I'll have to try it out, I don't think it's doing that intentionally.  I'll need to dig in the code and see what's going on before I can guess what drop it will make it into.
(5) - Definitely.  Also tentatively for the next drop.
(6) - Doable, another one that I'll need to look at the code at before predicting which drop will have it. 
(7) - That sounds like a bad bug, I'll look at it first.

Thanks for the feedback. 

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1238
  • Hero Points: 119
Re: Java Beautifier
« Reply #2 on: May 03, 2013, 03:30:33 pm »
Can you give an example of (4) that it's not formatting right?  I want to make sure I'm looking at the right thing.

(7) and (3) are checked in for the next beta drop. 

Tree

  • Community Member
  • Posts: 79
  • Hero Points: 2
Re: Java Beautifier
« Reply #3 on: May 03, 2013, 05:31:19 pm »
This gets reformatted with the commas on their own line.

Code: [Select]
public enum EnumTest {
    FOO() {
        @Override
        public void bar() {
        }
    },
    BAR() {
         @Override
         public void bar() {
         }
    },
    BAZ() {
         @Override
         public void bar() {
         }
    };

    public abstract void bar();
}

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1238
  • Hero Points: 119
Re: Java Beautifier
« Reply #4 on: May 03, 2013, 08:55:42 pm »
Ahh, that is indeed bad.   Fixed that and (5).  I'll probably get to (6) early next week, that will probably make the next beta drop as well.