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
Issue #7920: Resolve Pitest Issues - RedundantImportCheck #7929
Conversation
No regression was provided. Pitest report was not provided. @Gaurav-Punjabi Please provide us regression and pitest report as described in main issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added both the reports as a comment in the issue. Please review |
@romani Why is this travis build failing? I don't understand. |
Since regression didn't return anything and you have decided to remove the code, we need an analysis of the code that we should absolutely remove it and cannot create a test to satisfy it.
Is this a general statement or can you show this isn't possible by the code and an AST provided to it.
Will it always return false in any circumstance and why? |
Yes because
It's a general statement. Anyways even if pkgName is passed null, the second condition will still return false as described above. |
https://docs.oracle.com/javase/specs/jls/se13/html/jls-7.html#jls-7.5
It is more than a general statement, but a fact. I could find no way to import a class from an unnamed package as it just results in errors. it is also documented in So I am on the verge with agreeing with you.
So this is the whole crux of why the mutation survives is because this line is Does it make sense that we try to keep the |
Yes, I'm okay with this. It would surely reduce a function call and also kill the mutation. |
I think we should as long as pitest passes and no other part of |
d933ef8
to
407e44b
Compare
Done. |
407e44b
to
1f3491b
Compare
@Gaurav-Punjabi CI failied because commit is based on too old a version of master. Please rebase. |
1f3491b
to
01170e3
Compare
01170e3
to
715ecb1
Compare
Done rebased it to master. |
Fixes issue #7920
Description
This mutation was surviving
removed conditional - replaced equality check with true → KILLED
at line no 120.Solution
If
pkgName
is null it means this is an unnamed package and as an unnamed package cannot be imported we don't need to check if thepkgName
is null as the second condition will return false.