question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why there is collision between @Nullable annotation and real explanation?

See original GitHub issue

Hello. Inspection warns me about possible NPE on insertedId() in the chain of

        return storIo
                .put()
                .object(table)
                .prepare()
                .executeAsBlocking()
                .insertedId(); // Here is possible NPE

When i follow to the source i see @Nullable annotation and @return non-null results of Put Operation. explanation. So, how one can interpret it?

    /**
     * Executes Put Operation immediately in current thread.
     * <p>
     * Notice: This is blocking I/O operation that should not be executed on the Main Thread,
     * it can cause ANR (Activity Not Responding dialog), block the UI and drop animations frames.
     * So please, call this method on some background thread. See {@link WorkerThread}.
     *
     * @return non-null results of Put Operation.
     */
    @WorkerThread
    @Nullable
    public final Result executeAsBlocking() {
        return buildChain(storIOSQLite.interceptors(), getRealCallInterceptor())
                .proceed(this);
    }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
artem-zinnatullincommented, Dec 7, 2017

We can, we can remove nullability annotation from interceptor to leave it undefined

On Thu, Dec 7, 2017 at 1:07 AM Dmitrii Nikitin notifications@github.com wrote:

Actually we can’t prohibit nulls at all because we use the same interceptor interface for all operations https://github.com/pushtorefresh/storio/blob/d968a579c0094179dc26747c2ea01a08d9a36286/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/impl/DefaultStorIOSQLite.java#L267. And one of them can return null

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pushtorefresh/storio/issues/863#issuecomment-349906186, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7B3Hk_mQhU8BrRGB_90AQKjqL6qtPJks5s96q4gaJpZM4Q4-1m .

0reactions
nikitin-dacommented, Dec 19, 2017

Closed with #864

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the meaning of java.util.@Nullable? - Stack Overflow
It is a compile-time error if an annotation of type T applies to a type (or any part of a type) in a...
Read more >
null | The Object Teams Blog
I.e., if your code consistently uses null annotations, and has passed analysis without warnings, can we be sure that NPEs can only ever...
Read more >
@Nullable and @NotNull | IntelliJ IDEA Documentation
@Nullable and @NotNull annotations let you check nullability of a variable, parameter, or return value. They help you control contracts ...
Read more >
Null-Coalescing Operator in C# - GeeksforGeeks
In C#, ?? operator is known as Null-coalescing operator. It will return the value of its left-hand operand if it is not null....
Read more >
Nullable reference types - Microsoft Learn
In a nullable oblivious context, all reference types were nullable. Nullable reference types refers to a group of features enabled in a nullable ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found