Issue #13501: Kill mutation for AnnotationUtil#13415
Issue #13501: Kill mutation for AnnotationUtil#13415romani merged 1 commit intocheckstyle:masterfrom
Conversation
|
https://kevin222004.github.io/PitestReport/com.puppycrawl.tools.checkstyle.utils/AnnotationUtil.java.html |
|
@romani Again NoStackoverFlowError As far I don't remember we have done any changes in favour of pitest which create this type of issue |
romani
left a comment
There was a problem hiding this comment.
I ok to remove such null validation.
I see no value in them, it is still exception, absolutely sae details user will get from NPE.
throw new IllegalArgumentException("annotations cannot be null"); also can be removed and all similar
|
@Kevin222004 please resolve conflicts |
|
@Kevin222004 , conflict |
802a877 to
c5aa526
Compare
|
@Kevin222004 , CI is failing |
|
Can you please re run circle ci |
@Kevin222004 Just add some change, push the commit, remove that change, push again, that will re trigger the CI with current changes. You can use this if no one is around. |
|
CIs were restarted |
|
@Kevin222004 , please resolve conflict |
|
conflict resolved |
Issue #13501: Kill mutation for AnnotationUtil
Mutations
checkstyle/config/pitest-suppressions/pitest-utils-suppressions.xml
Lines 3 to 10 in 8804126
Explaination
Method 1
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Lines 90 to 96 in 8804126
This method
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Line 91 in 8804126
is mutated and the usage of this method is only in the check
PackageAnnotationCheckcheckstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java
Lines 107 to 109 in 8804126
at line no 109 as this is visit token and no other such operation is perfoming on ast it will only be the acceptaed token which is
PACKAGE_DEFsocheckstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Lines 91 to 93 in 8804126
this removal will not make any affect
Second reason
may be stronger then above one
lets suppose above we have not condition
ast == nulland by chance ast is null then while callingcheckstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Line 94 in 8804126
getAnnotationHolder already have this condition
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Lines 178 to 181 in 8804126
Method 2
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Lines 113 to 116 in 8804126
in which similar mutation at line 114
know this method is called by one method in same class at
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Lines 165 to 167 in 8804126
and this method is used by 5 Checks
1) ParameterNumberCheck :-
usage of method is at
https://github.com/checkstyle/checkstyle/blob/
8804126/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java#L177-L181
line 180 know this method in ast is called only at visit token at line 164
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java
Lines 161 to 164 in 8804126
over here directly ast is used which is in parameter so it is also bever going to null
2) MissingOverrideCheck :-
Similar reason as above the usage is at
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java
Lines 227 to 253 in 8804126
the method is used at line 248 and similar ast is direclty passed from parameter.
3) MethodNameCheck :-
Similar reason for method name check
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java
Lines 231 to 235 in 8804126
4) IllegalThrowsCheck :-
Similar reason
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java
Lines 228 to 232 in 8804126
5) IllegalTypeCheck :-
Similar reasons
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java
Lines 807 to 812 in 8804126
Second reason
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Line 125 in 8804126
call
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Lines 255 to 257 in 8804126
and it is calling
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java
Lines 178 to 181 in 8804126
so here ast is checked again