Menu

#438 enum formatting munges whitespace

1.5b5
closed-fixed
S
Core (71)
5
2005-12-19
2005-10-26
Adam Zell
No

Given the following source with 1.5b3:

public final class HttpRequest
{
public enum Method
{
/** Data is encoded in the query. */
GET,

/** Data is encoded in the body. */
POST
}
}

and the command line:

jalopy.sh -d _new JalopyTest.java

I get back (also attached):

public final class HttpRequest {
public enum Method {/** Data is encoded in the
query. */
GET,

/** Data is encoded in the body. */
POST;
}
}

Note that there is now a trailing space after "GET," and
that the GET comment has been glued to the previous
line's {.

Discussion

  • Adam Zell

    Adam Zell - 2005-10-26

    Processed source file

     
  • S

    S - 2005-11-07
    • status: open --> pending
     
  • S

    S - 2005-11-07

    Logged In: YES
    user_id=723231

    The trailing space is correct (If you have specified 1 blank
    line for javadoc comments (See blank lines))

    All javadoc and sperator comments will now start on there
    own line

     
  • S

    S - 2005-11-07
    • status: pending --> pending-fixed
     
  • S

    S - 2005-11-07
    • assigned_to: nobody --> notzippy
     
  • Adam Zell

    Adam Zell - 2005-11-07
    • status: pending-fixed --> open-fixed
     
  • Adam Zell

    Adam Zell - 2005-11-07

    Logged In: YES
    user_id=152749

    Just to clarify, is the following behavior intended:

    "GET, " <-- Note the trailing space after the comma to end
    of line

    This is the only instance I have seen so far where Jalopy
    will insert whitespace before the end of line. The
    resulting regex of '[ \t]+$' causes tools such as
    Checkstyle to complain.

    Thanks.

     
  • S

    S - 2005-11-14
    • status: open-fixed --> closed-fixed
     
  • S

    S - 2005-11-14

    Logged In: YES
    user_id=723231

    While printing the enumeration block the enum constant
    printer now checks to see if a new line is being printed
    after the enum constant. If this is true then no space is
    printed following the commas (regardless of the white space
    setting for commas).

     
  • Adam Zell

    Adam Zell - 2005-11-19
    • milestone: 517041 --> 1.5b5
    • status: closed-fixed --> open
     
  • Adam Zell

    Adam Zell - 2005-11-19

    Logged In: YES
    user_id=152749

    The same behavior occurs with 1.5b5:

    public enum Method
    {
    /**
    * Data is encoded in the query.
    */
    GET,
    /**
    * Data is encoded in the body.
    */
    POST;}

    Note that the first "{" now retains its position, but the
    trailing space following "GET," remains as does the "}"
    immediately following "POST;".

    Lastly, what is the policy for whitespace between enum
    elements? The original source had a newline between "GET"
    and "POST" which was removed by jalopy.

    Jalopy-processed source attached. Thanks for the great tool
    and support.

     
  • Adam Zell

    Adam Zell - 2005-11-19
     
  • S

    S - 2005-11-21

    Logged In: YES
    user_id=723231

    ok the issue (now) is in your printer settings.
    Goto printer->wrapping->misc. Change Enumerations->Left
    brace starts new line wrap after (change to) "1" (the
    default is 3).
    This will supress the blank space. Of course all enums
    constants will now start a new line also.

    I will leave this open though since it should behave
    properly without modifying that setting.

    Z

     
  • Adam Zell

    Adam Zell - 2005-11-21

    Logged In: YES
    user_id=152749

    I have made the suggested printing change, which removes the
    unwanted trailing space after the first enum element.

    I still have "POST;}" on the last line, when I would prefer
    that the closing "}" be on a separate line. Is there
    another setting I can change?

    Thanks.

     
  • S

    S - 2005-11-28
    • status: open --> pending-fixed
     
  • S

    S - 2005-11-28

    Logged In: YES
    user_id=723231

    Fixed, There wont be any control on this setting for the
    time being though.

     
  • S

    S - 2005-12-19
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.