-
Notifications
You must be signed in to change notification settings - Fork 64
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
rewise early exit to positive condition in EqualsAvoidsNull
#488
rewise early exit to positive condition in EqualsAvoidsNull
#488
Conversation
EqualsAvoidsNull
@greg-at-moderne kindly request feedback |
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.
TBH, I don't fully find it better with the overloaded standard visit...
method.
yes thats non a good story telling. Structuring it with SOC is ok, right? Its just about finding the proper size and name. Please see updates version. Thx |
Expression firstArgument = m.getArguments().get(0); | ||
|
||
private J applyLiteralsFirstInComparisons(J.MethodInvocation m, Expression firstArgument) { | ||
checkPotentialNullCheck(m, getCursor().getParentTreeCursor().getValue()); |
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 don't know how checkPotentialNullCheck
is working, but from the storytelling here, I would expect this to act as an early exit. A null check does not get flipped, which doesn’t make sense because null is checked again below in literalsFirstInComparisonsNull
, so it must be treated as well.
Therefore, it seems more like a treatment or preparation step and should be renamed to preparePotentialNullCheck
to better reflect its purpose in allowing the process to continue.
133ce35
to
e8a1460
Compare
What's changed?
EqualsAvoidsNull
one thing only
What's your motivation?