yahoo/squidb

Request: add annotations of @Null and @NonNull when needed

AndroidDeveloperLB opened this issue · 8 comments

As an example:

final SquidCursor<SomeEntity> cursor = fetchFirstItem(SomeEntity.class, query);

The returned value is always not-null, because "fetchFirstItem" calls "query" , which always returns "new SquidCursor" .

So, you could make it this way:

@NotNull
protected <TYPE extends AbstractModel> SquidCursor<TYPE> fetchFirstItem(Class<TYPE> modelClass, Query query) {

This can help with handling possible errors.

We can consider this, but I think it's unlikely we'll be able to add these since my hunch is that they wouldn't be supported by j2objc on our 3.0 dev branch. In 3.0, the main squidb module is a jar that needs to be free of android dependencies, and these annotations are found in the android support annotations library.

But this repo is only for Android, no?
Isn't there a way to overcome this?

At least, add Javadocs to tell for each function its rules of parameters
and returned values...

On Thu, Apr 7, 2016 at 5:51 PM, Sam Bosley notifications@github.com wrote:

We can consider this, but I think it's unlikely we'll be able to add these
since my hunch is that they wouldn't be supported by j2objc on our 3.0 dev
branch. In 3.0, the main squidb module is a jar that needs to be free of
android dependencies, and these annotations are found in the android
support annotations library.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#155 (comment)

The repo is android-only at the moment on the master branch, but it won't be when the dev_3.0 branch is merged. We're moving towards multi-platform support instead of being an Android-only library.

Javadocs are an option. If you see places where you think the documentation could be more detailed feel free to open a pull request!

Every function should have Javadocs, especially those that are most used.

On Thu, Apr 7, 2016 at 6:08 PM, Sam Bosley notifications@github.com wrote:

The repo is android-only at the moment on the master branch, but it won't
be when the dev_3.0 branch is merged. We're moving towards multi-platform
support instead of being an Android-only library.

Javadocs are an option. If you see places where you think the
documentation could be more detailed feel free to open a pull request!


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#155 (comment)

This is being worked on using the JSR305 nullability annotations.

We've just released version 4.0 beta 2, which adds jsr305 @Nullable and @Nonnull to the squidb public API and generated code. If you'd like to try out the latest beta, see the README on this branch.

@sbosley Are there any changes needed in gradle/code for moving to this version from the one I used here:
#263
?

@AndroidDeveloperLB yes to both. The 4.0 beta versions contain several changes from the 3.x versions. I'll outline a few here, but you should read the full changelog to determine if any of the other changes will affect your code.

The new version for all the artifacts in your build.gradle is 4.0.0-beta.2 instead of 3.2.3, as is documented in the README that I linked to in my last comment. If you read the CHANGELOG on that branch, you will also see that various annotations for model specs have changed or have been moved to new packages, so some of your model specs may require updating to use the new annotations or to fix imports.

Since this is just a beta and things may change more in future versions, the required changes are only outlined in a general fashion; they are NOT yet documented thoroughly or with detailed examples (although some examples exist in the test project). If you read the changelog and decide you want to try the latest beta but are having trouble making the necessary changes to your model specs, you can get more support on our gitter chat. We're happy to offer any support you need there, but please don't use github issues or comments for general support questions about the beta just yet, unless it is reporting an actual bug.

The full changelog for the beta can be found here. If you are upgrading from version 3.x to the beta, I recommend reading the changelog for 4.0 beta 1 and beta 2 -- there have been several significant changes that may affect other parts of your code too. And again, if you need any help, don't hesitate to join our gitter chat!