#126 paren.pad=space catches casts

release_3.0
closed
Lars Kühne
None
5
2012-10-10
2002-12-13
Anonymous
No

We use a style with padded parens for everything
except casts. It would be nice if there were a
paren.castpad option to allow for this.

Great tool!
Thanks,
Robert Mecklenburg
mecklen@cimsoft.com

Discussion

  • Lars Kühne
    Lars Kühne
    2002-12-27

    Logged In: YES
    user_id=401384

    We're way ahead of you :-)

    The upcoming version of Checkstyle (release 3.0) will allow
    fine grained control over the token types a check is applied
    to. Here is a configuration file snippet that should do what
    you asked for (untested).

    <module name="Checker">
    <module name="TreeWalker">
    <module name="ParenPad">
    <property name="tokens" value="TYPECAST"/>
    <property name="option" value="nospace"/>
    </module>
    <module name="ParenPad">
    <property name="tokens" value="RPAREN, LPAREN, CTOR_CALL,
    SUPER_CTOR_CALL, METHOD_CALL"/>
    <property name="option" value="space"/>
    </module>
    <!-- add more TreeWalker modules here -->
    </module>
    </module>

    It would be really great if you could try out the current
    CVS and tell us if this does what you need.