Issue #13109: Kill mutation for UnusedLocalVariableCheck 6#13149
Merged
romani merged 1 commit intocheckstyle:masterfrom Jun 12, 2023
Merged
Issue #13109: Kill mutation for UnusedLocalVariableCheck 6#13149romani merged 1 commit intocheckstyle:masterfrom
romani merged 1 commit intocheckstyle:masterfrom
Conversation
Contributor
Author
|
Github, generate report |
Contributor
Contributor
Author
|
Github, generate report |
Contributor
Author
|
NPE in intellij is in existing version |
Contributor
romani
approved these changes
Jun 11, 2023
40 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #13109: Kill mutation for UnusedLocalVariableCheck 6
Checks
https://checkstyle.org/config_coding.html#UnusedLocalVariable
Mutation covered
checkstyle/config/pitest-suppressions/pitest-coding-2-suppressions.xml
Lines 309 to 316 in 9580515
Explaination
hence it is not possible to create a such test that kills mutation. instead of starting the loop with
literalNewAst.getParent()if we start fromliteralnewAstat the end of the first iteration in the loop it will become literalNewAst.getParent. loops run one time more then it was running previously.hence while as per my changes currentAST go in loop it never be in array of CONTAINERS_FOR_ANON_INNERS
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java
Lines 188 to 194 in 9580515
because it always be TokenTypes.Literal_NEW. same for if statment in it
currentAST never be TokenTypes.lambda so it will not execute
so removal will not make any effect
Diff Regression config: https://gist.githubusercontent.com/Kevin222004/0dbdfb487f8e9a050ed0e6356f1a35b4/raw/31f7927f400e11e4285e86fd086b373095227848/unusedLocal.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/9600f179b602d4c971bdb0a050099005/raw/360a95ed7bb60d7a0956e531199d484c4d6f6617/test-projects.properties
Report label: Regression-2