Skip to content

Issue #13501: Kill mutation for JavadocTypeCheck3#13564

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:JavadocTypeCheck3
Aug 23, 2023
Merged

Issue #13501: Kill mutation for JavadocTypeCheck3#13564
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:JavadocTypeCheck3

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 commented Aug 17, 2023

Issue #13501: Kill mutation for JavadocTypeCheck3


Check

https://checkstyle.org/checks/javadoc/javadoctype.html#JavadocType


Mutation

<mutation unstable="false">
<sourceFile>JavadocTypeCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck</mutatedClass>
<mutatedMethod>checkTypeParamTag</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/util/stream/Stream::filter with receiver</description>
<lineContent>.filter(JavadocTag::isParamTag)</lineContent>
</mutation>

We filter only params at

so it is double check, not required.

But test was added.


Regression :-

Report-1 :- https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/6d4c16b_2023215123/reports/diff/index.html

Report-2 :- https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/6d4c16b_2023234000/reports/diff/index.html


Diff Regression config: https://gist.githubusercontent.com/Kevin222004/e591a1cf82070108242c5569a7236a01/raw/9b17bf12fa20506af727bb7cae5c18b5b6dfe4ec/JavadocTypeCheck.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/9600f179b602d4c971bdb0a050099005/raw/360a95ed7bb60d7a0956e531199d484c4d6f6617/test-projects.properties
Report label: Regression-2

@Kevin222004 Kevin222004 marked this pull request as draft August 17, 2023 21:38
@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Github, generate report

@github-actions
Copy link
Copy Markdown
Contributor

@Kevin222004
Copy link
Copy Markdown
Contributor Author

Non ast based check

@Kevin222004 Kevin222004 marked this pull request as ready for review August 20, 2023 17:28
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 assigned Vyom-Yadav and unassigned rdiachenko Aug 21, 2023
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.

Item:


final boolean found = tags
.stream()
.filter(JavadocTag::isParamTag)
Copy link
Copy Markdown
Member

@Vyom-Yadav Vyom-Yadav Aug 22, 2023

Choose a reason for hiding this comment

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

We filter only params at .... so it is double check, not required.

Nope, it is not. At CheckUtil.getTypeParameterNames(ast); we only get the parameter names from the Method or class, etc. We don't check anything regarding Javadoc.

This mutation can be killed by:

/**                                                                   
 *                                                                    
 * @link <T>                                                          
 */                                                                   
protected class InnerPublic2<T> // violation 'missing @param <T> tag.'
{                                                                     
}                                                                     

If we remove .filter(JavadocTag::isParamTag) then it won't give a violation which is wrong. We just compare the first argument of the tag, it may or may not be the same as the value that @param is supposed to have.

@Kevin222004 Please add this test case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot @Vyom-Yadav for test case

@romani romani assigned romani and unassigned Vyom-Yadav Aug 22, 2023
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

@romani romani merged commit 33ad62b into checkstyle:master Aug 23, 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.

4 participants