Skip to content

Commit

Permalink
Issue checkstyle#12486: NoWhitespaceAfter shouldn't check synchronize…
Browse files Browse the repository at this point in the history
…d method
  • Loading branch information
nrmancuso committed Dec 2, 2022
1 parent ae24c2f commit 68b724d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -286,8 +286,8 @@ private static boolean shouldCheckWhitespaceAfter(DetailAST ast) {
final DetailAST previousSibling = ast.getPreviousSibling();
final boolean isSynchronizedMethod = ast.getType() == TokenTypes.LITERAL_SYNCHRONIZED
&& ast.getFirstChild() == null;
return (previousSibling == null || previousSibling.getType() != TokenTypes.ANNOTATIONS)
&& !isSynchronizedMethod;
return !isSynchronizedMethod
&& (previousSibling == null || previousSibling.getType() != TokenTypes.ANNOTATIONS);
}

/**
Expand Down
Expand Up @@ -354,15 +354,15 @@ public void testNoWhitespaceAfterWithEmoji() throws Exception {
getPath("InputNoWhitespaceAfterWithEmoji.java"), expected);
}

@Test
@Test
public void testNoWhitespaceAfterSynchronized() throws Exception {

final String[] expected = {
"18:9: " + getCheckMessage(MSG_KEY, "synchronized"),
};

verifyWithInlineConfigParser(
getPath("InputNoWhitespaceAfterSynchronized.java"), expected);
getPath("InputNoWhitespaceAfterSynchronized.java"),
expected);
}

/**
Expand Down

0 comments on commit 68b724d

Please sign in to comment.