Skip to content

Issue #13109: Kill mutation for EqualsAvoidNullCheck#13124

Merged
rdiachenko merged 1 commit intocheckstyle:masterfrom
Kevin222004:EV1
Jun 2, 2023
Merged

Issue #13109: Kill mutation for EqualsAvoidNullCheck#13124
rdiachenko merged 1 commit intocheckstyle:masterfrom
Kevin222004:EV1

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 commented Jun 1, 2023

Issue #13109: Kill mutation for EqualsAvoidNullCheck

1 check :- https://checkstyle.org/config_coding.html#EqualsAvoidNull

2covering :-

<mutation unstable="false">
<sourceFile>EqualsAvoidNullCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck</mutatedClass>
<mutatedMethod>isStringFieldOrVariableFromClass</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck::getObjectFrame with argument</description>
<lineContent>FieldFrame frame = getObjectFrame(currentFrame);</lineContent>
</mutation>

3 Explaination
getObjectFrame() method will provide the nearest parent frame of class, enum.

if we remove getObjectFramefrom the FieldFrame frame = getObjectFrame(currentFrame); and frame = getObjectFrame(frame.getParent()); they will go through all the frame instead of directly going to frame which are class or enum.

and as per the condition in loop className.equals(frame.getFrameName())
frameName would always be of class enum as per

/** Name of the class, enum or enum constant declaration. */
private String frameName;

so removal of that not make any issue
https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/b863d4b_2023095222/reports/diff/index.html

@Kevin222004
Copy link
Copy Markdown
Contributor Author

GitHub, generate report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 1, 2023

Report generation failed on phase "parse_body",
step "Parsing content of PR description".
Link: https://github.com/checkstyle/checkstyle/actions/runs/5141311887

@Kevin222004
Copy link
Copy Markdown
Contributor Author

GitHub, generate report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 1, 2023

@Kevin222004 Kevin222004 marked this pull request as draft June 2, 2023 05:02
@Kevin222004 Kevin222004 marked this pull request as ready for review June 2, 2023 06:46
@romani romani requested review from Vyom-Yadav and rdiachenko June 2, 2023 13:11
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

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.

lgtm

@rdiachenko rdiachenko merged commit 82b6ac4 into checkstyle:master Jun 2, 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.

3 participants