-
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
Introduce MapGetOrDefault
Refaster rule
#439
Introduce MapGetOrDefault
Refaster rule
#439
Conversation
Looks good. No mutations were possible for these changes. |
Map#getOrDefault
Refaster rulesMap#getOrDefault
Refaster rules (#431)
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.
Tnx for your contribution!
Suggested commit message:
Introduce `MapGetOrDefault` Refaster rule (#439)
Fixes #431.
error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapRules.java
Outdated
Show resolved
Hide resolved
error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapRules.java
Outdated
Show resolved
Hide resolved
...prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/MapRulesTestInput.java
Outdated
Show resolved
Hide resolved
Looks good. No mutations were possible for these changes. |
Map#getOrDefault
Refaster rules (#431)Map#getOrDefault
Refaster rules
6415c17
to
7229ade
Compare
Looks good. No mutations were possible for these changes. |
7229ade
to
06a7d46
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.
Added a commit and rebased.
Made a tweak to the suggested commit message :).
I'm afraid we should wait a bit more with merging this one. I already started testing the current master
on downstream repositories, so would probably be better to include this in next release :).
Thanks for another contribution @benhalasi 🚀 !
Looks good. No mutations were possible for these changes. |
1 similar comment
Looks good. No mutations were possible for these changes. |
adds rules to fix PicnicSupermarket#431.
060863e
to
6852705
Compare
Looks good. No mutations were possible for these changes. |
Map#getOrDefault
Refaster rulesMapGetOrDefault
Refaster rule
adds rules to fix #431.
Added Rules:
map.getOrDefault(k, defaultValue)
overrequireNonNullElse(map.get(k), defaultValue)
Wrote test inputs and outputs.
Could be a problem that when
defaultValue
is null,Objects#requireNonNullElse
throws a NPE whileMap#getOrDefault
does not.