-
Notifications
You must be signed in to change notification settings - Fork 39
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
Ignore type variable casts in ClassCastLambdaUsage
check
#1449
Ignore type variable casts in ClassCastLambdaUsage
check
#1449
Conversation
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
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.
Actually, it was @EnricSala who pointed this out 😉.
Added a suggestion :).
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
@@ -48,7 +49,10 @@ public Description matchLambdaExpression(LambdaExpressionTree tree, VisitorState | |||
} | |||
|
|||
Type type = ASTHelpers.getType(typeCast); | |||
if (type == null || type.isParameterized() || type.isPrimitive()) { | |||
if (type == null |
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.
I'm confused now, was the pitest warning already here or is it new 🤔?
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.
AFAIK:
- It was in the original commit, pre suggestions.
- It was introduced with this PR, so it is probably referencing mutating the
#isPrimitive
call 🤔
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.
Thanks for checking @mohamedsamehsalah 🚀🚀🚀!
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.
Any clue why is this reported? 😅
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.
Any clue why is this reported? 😅
I re-read the warning line
A change can be made to line 52 without causing a test to fail
referncing mutating the nullability check; which seems like a common warning for similar PRs (for example, here).
3dbc7fa
to
79d807b
Compare
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.
Rebased and added a commit. Tnx @mohamedsamehsalah and @EnricSala!
Suggested commit message:
Ignore type variable casts in `ClassCastLambdaUsage` check (#1449)
@rickie I'll let you merge if you agree with the changes.
/* | ||
* The method reference syntax does not support casting to parameterized types. Additionally, | ||
* `Class#cast` does not support the same range of type conversions between (boxed) primitive |
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.
We should update this comment.
" private <T> void m2() {", | ||
" Stream.of(11).map(i -> (T) i);", |
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.
We can add the type variable to m()
instead.
ClassCastLambdaUsage
checkerClassCastLambdaUsage
check
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
79d807b
to
fc3ecbd
Compare
Rebased, changes LGTM! |
Quality Gate passedIssues Measures |
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
Thanks for pointing out @rickie 🙏
Suggested commit message