-
Notifications
You must be signed in to change notification settings - Fork 267
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
add Nonnull and Nullable annotations to ContextRun function #206
Conversation
…ons to other functions will be added in later changes
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 have a little reservation that you picked this ContextRun
function, as typical ParSeq users, these functions are too internal to them. I would encourage them to always try to use methods provided in Task
class. So if we would like to add Nonnull
or Nullable
, I may prefer to start from there.
@mchen07 agree. I just picked the first public function in |
I may prefer that we start with adding annotation to |
…Annotations to other functions will be added in later changes" This reverts commit 89f32cb.
@mchen07 reverted original commit and added |
@@ -35,6 +35,7 @@ configurations { | |||
} | |||
|
|||
dependencies { | |||
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' |
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.
why do we need to add this findbugs dependency? As we discussed earlier, I hope that this annotation should not depend on one particular static analysis tools.
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.
javax.annotation
package is part of findbugs. This is just lib import, we don't need to run findbugs to use these annotations but if you're not willing to import lib as well then this change can't be made.
In my opinion importing this lib should not have any impact and it's a very standard practice.
let me know what you think.
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.
@mchen07 bump
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.
Sorry for the delay. I am still struggling whether we should introduce such @nullable annotation where different IDE may have different support (for example, IntelliJ has its own @nullable support, which is different from javax.annotation
, see https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html), or instead we should use java Optional to indicate this, where we don't depend on the implementation of static code analysis tool.
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.
Hey @mchen07 documentation doesn't mentions it (probably old) but IntelliJ supports it. You can go to Intellij Preferences -> Editor -> Inspections -> Java -> Probable bugs -> @NotNull/@Nullable problems -> Configure annotations
There you can see javax.annotation.Nullable
and Notnull
too
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 the tip @hiteshsharma. Have you seen this: spotbugs/spotbugs#180? Recently spotbugs is preferred over findBugs, will this have side effect on that trend?
This change adds support for
javax.annotation.Nonnull
andjavax.annotation.Nullable
annotations for Parseq API.This change is a follow up on discussion #205
This change only adds annotations for
Task.contextRun
method. Once this is accepted, I'll create more changes for adding annotations to other functions.Annotations are decided based on current code usage.
@mchen07