Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #12282: Resolve Pitest suppression for ParenPad #12318

Merged
merged 1 commit into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@
<lineContent>processLeft(ast.findFirstToken(TokenTypes.LPAREN));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>ParenPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck</mutatedClass>
<mutatedMethod>visitToken</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_3</mutator>
<description>RemoveSwitch 3 mutation</description>
<lineContent>switch (ast.getType()) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>ParenPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck</mutatedClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,16 @@ public void testParenPadCheckEmoji() throws Exception {
getPath("InputParenPadCheckEmoji.java"), expected);
}

@Test
public void testParenPadForSynchronized() throws Exception {

final String[] expected = {
"18:29: " + getCheckMessage(MSG_WS_PRECEDED, ")"),
};
verifyWithInlineConfigParser(
getPath("InputParenPadForSynchronized.java"), expected);
}

/**
* Pitest requires us to specify more concrete lower bound for condition for
* ParenPadCheck#isAcceptableToken as nodes of first several types like CTOR_DEF,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
ParenPad
option = (default)nospace
tokens = LITERAL_SYNCHRONIZED, CTOR_DEF, CTOR_CALL, LITERAL_IF


*/

package com.puppycrawl.tools.checkstyle.checks.whitespace.parenpad;

class InputParenPadForSynchronized {

private static InputParenPadForSynchronized instance = null;
private InputParenPadForSynchronized() {
}

public synchronized static InputParenPadForSynchronized getInstance() {
if(instance == null ) { // violation
instance = new InputParenPadForSynchronized();
}
return instance;
}
}