Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support LITERAL_SYNCHRONIZED token for NoWhitespaceAfter Rule #2803
I would like to create a rule to make sure there is no space before the left param for synchronized, i.e. I would like to have the style
Problem is in set of Allowed tokens - https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java#L102
See the discussion on the mailing list here, https://groups.google.com/forum/#!topic/checkstyle/cgNOY2uJDAY.
here aa10329 Check was allowed to have any token validation (2002 year).
list of strict token set is restored at 103a206 (2006 year)
so we did not change it recently ... that is good.
Validation of no spaces between method name and list of arguments is done by http://checkstyle.sourceforge.net/config_whitespace.html#MethodParamPad
MethodParamPad is too specific to method to be reused, it will not be clear for user that such could do this.
@mkordas , the reason of AllowedTokens collection is to restrict user from usage token that will break Check logic and cause him to throw Exceptions or produce false-positives.
In short: misconfiguration is problem of user, exceptions and incorrect validation is Checkstyle problems.
But I do not want to allow all tokens in this Check for now.
@elingg , if you have time and desire to help, please update Check code and UTs for this case, and xdoc files to have on our website example of how to do this (users like examples).
Google style configuration need to be updated, see http://checkstyle.sourceforge.net/google_style.html, NoWhitespaceAfter need to be used in default configuration to cover "4.6.2" point.
you are welcome with PR.