Skip to content

Issue #13108: Resolves Pitest for AbstractSuperCheck#13111

Merged
nrmancuso merged 1 commit intocheckstyle:masterfrom
Kevin222004:ASC1
May 31, 2023
Merged

Issue #13108: Resolves Pitest for AbstractSuperCheck#13111
nrmancuso merged 1 commit intocheckstyle:masterfrom
Kevin222004:ASC1

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

Issue #13108: Resolves Pitest for AbstractSuperCheck

covering

<mutation unstable="false">
<sourceFile>AbstractSuperCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.coding.AbstractSuperCheck$MethodNode</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable callingSuper</description>
<lineContent>callingSuper = false;</lineContent>
</mutation>

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Test cases not found.

private MethodNode(DetailAST ast) {
method = ast;
callingSuper = false;

In the constructor only the parameter ast is taken for private final DetailAST method; every time when the object of MethodNode class is created then private boolean callingSuper; is been set false by the constructor intially.

By default in java the value of none initalize boolean variable is false;
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html#:~:text=boolean-,false,-Local%20variables%20are
so if it is been removed it not make any changes.

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Kevin222004 commented May 30, 2023

This might not be a good practice to leave a variable on default initialization and not initialize it by ourselves.
There are lots of mutations similar to this.

@romani @Vyom-Yadav @rdiachenko do you have any suggestions for this type of case?

@Kevin222004
Copy link
Copy Markdown
Contributor Author

@rdiachenko
Copy link
Copy Markdown
Member

This might not be a good practice to leave a variable on default initialization and not initialize it by ourselves. There are lots of mutations similar to this.

@romani @Vyom-Yadav @rdiachenko do you have any suggestions for this type of case?

If it's a primitive type like boolean I don't see why we shouldn't rely on default initialization. If you check other checks we do rely on default false for boolean properties.

Copy link
Copy Markdown
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

Copy link
Copy Markdown
Contributor

@nrmancuso nrmancuso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kevin222004 different SHA of patch branch in reports and PR is questionable; if we are removing code, regression reports should be generated on final SHA of the commit in your PR.

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Kevin222004 commented May 31, 2023

@nrmancuso I am also not sure how this happens, I will generate it again.

Copy link
Copy Markdown
Member

@Vyom-Yadav Vyom-Yadav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@romani romani assigned nrmancuso and unassigned Vyom-Yadav May 31, 2023
@Kevin222004
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to merge

@nrmancuso nrmancuso merged commit 6823f21 into checkstyle:master May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants