New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve Pitest Issues - AvoidStarImportCheck (1) #7799
Comments
I'm on it. |
…1): Hardcoded mutation
Pitest report
Hardcoded mutation
Regression diff reports Recall of check properties
Default configuration <module name="AvoidStarImport"/>
Non default configuration 1 <module name="AvoidStarImport">
<property name="excludes" value="java.io,java.net,java.lang.Math"/>
</module>
Non default configuration 2 <module name="AvoidStarImport">
<property name="allowClassImports" value="true"/>
</module>
Non default configuration 3 <module name="AvoidStarImport">
<property name="allowStaticMemberImports" value="true"/>
</module>
Code analysis The regression diff reports do not find any UT which kills the surviving mutation and I think this is because the condition is really not needed.
We're only interested in the 2nd case here, and in that case there's clearly no violation. Bottom line : I propose to keep the mutation. Related PR is #7843 NB For non default configurations I have only uploaded android-launcher diff report because my git repo is becoming way too big. Be assured that the results are the same for all other projects. |
…1): Hardcoded mutation
I agree that the 2nd one is the more important one. Regression was expanded to much more properties and permutations, so I am good regression won't help us.
Please convince me that the best choice is to remove the code, as there is no way this can produce any violation issues when released. Why does, when the 2nd case's requirements are met, a violation is not produced? Do we have a duplicate check somewhere that checks for STATIC_IMPORT? What happens differently when ast is IMPORT versus STATIC_IMPORT that something else down the line won't produce a violation, no matter what, when the |
Let's assume the 2nd case's requirements are met for some import statement.
That's why there is no violation. |
I agree with your number 1, but number 2 plays no role here. There are no further checks for I want to know what prevents a violation happening inside the condition under all circumstances. |
Yeah but since we're in case 2 of #7799 (comment), we know for sure that that property's value is
I agree with this completely, and what I am saying is that knowing At least that's what I thought from the property's description, but maybe I'm misunderstanding. |
@rnveach I got proof! I just ran import java.util.*; // a class import with a star
class Foo{
private int a;
/* public comment */ // OK, comment is ignored
public bar1() {} // violation
public bar2() {} // violation
} For each of the two following configs: <module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="AvoidStarImport"/>
</module>
</module> And <module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="AvoidStarImport">
<property name="allowClassImports" value="true"/>
</module>
</module> the results are respectively:
And
I believe this proves my point.
|
Yes, but without it being used anymore it is not proof that it has any impact in the condition.
I don't see how this proves what is happening inside the code between 2 versions of checkstyle when you are only using 1 version in your example. Surely regression would have had this case already. I suggest we walk through the code line by line inside the condition with a STATIC_IMPORT and IMPORT and see where the differences fall. |
Ok let's do that.
So at |
@rnveach , please your thoughts |
This makes more sense now.
There was a small leap not saying how importText got its value but its directly from the AST brought in which is only a I agree now, there is no way to satisfy the code as it is now except to change it somehow, either remove the mutated code or rewrite the code. |
Fix was merged |
Child issue of #7797 ,
This issue specifically focuses on the line
checkstyle/.ci/pitest.sh
Line 74 in abf829f
The text was updated successfully, but these errors were encountered: