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.

@Nullable / @NonNull

See original GitHub issue

I use these annotations a LOT and I don’t think you use them. Would you consider adding them?

For example, Box#put supports null collections but doesn’t say so:

public void put(Collection<T> entities) {
    if(entities != null && !entities.isEmpty()) { // yay!
        Cursor cursor = getWriter();
        try {
            Iterator i = entities.iterator();
            while(i.hasNext()) {
                cursor.put(i.next());
            }
           commitWriter(cursor);
        } finally {
           releaseWriter(cursor);
        }
    }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
greenrobotcommented, Jun 2, 2017

I tried to use compileOnly for jsr305. This seems to break kapt rather quickly. Also, annotations are already used in generated code / super classes of generated code. Thus, it seems simpler to stick with a compile dependency. Added a troubleshooting entry in the FAQ for this.

1reaction
greenrobotcommented, Apr 21, 2017

@BenoitDuffez I’m just finishing this, so no need to reopen. Will ship with next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@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 >
Nullable & NonNull - Medium
The @NonNull/@Nullable annotation can put in front of functions as well to indicate the return value nullability. @NonNull public A getA() {
Read more >
java - How to use @Nullable and @Nonnull annotations more ...
@Nonnull annotation just emphasises that null-verification of the argument is on your side (you have to guarantee that you pass non-null value). It...
Read more >
Spring Null-Safety Annotations - Baeldung
The @Nullable Annotation. The @NonNullFields annotation is generally preferable to @NonNull as it helps reduce boilerplate.
Read more >
@NonNull - Project Lombok
You can use @NonNull on a record component, or a parameter of a method or constructor. This will cause to lombok generate a...
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