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.

Consider adding @Nullable / @Nonnull annotations to generated services

See original GitHub issue

Please answer these questions before submitting your issue.

What version of gRPC are you using?

1.13.2

What did you expect to see?

It would be very helpful for those of us implementing *ImplBase classes in Kotlin if the parameters of generated rpc methods were annotated with @javax.annotation.Nonnull as it gives tooling a hint that the signature of an override should use the non-nullable form of the parameter types.

Minor, but would make implementing services in Kotlin that bit more seamless.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:9
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

5reactions
MarkMarinecommented, Aug 14, 2018

I would like to see these annotations included for kotlin, I’m writing server side kotlin code using grpc and it would make my life a lot better if they were everywhere in the library, generated code and non-generated code. Bringing along another dep is inconsequential compared to the code elegance that would be gained

1reaction
dapengzhang0commented, Aug 2, 2018

And javax.annotation:javax.annotation-api (including javax.annotation.Generated) and jsr305 (@Nullable) are different dependencies.

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 >
java - How to use @Nullable and @Nonnull annotations more ...
1. Propagating the @Nonnull to have indirectPathToA(@Nonnull Integer y) is IMHO a bad practice: you will need to mainain the propagation on the...
Read more >
@NoArgsConstructor, @RequiredArgsConstructor ...
For those fields marked with @NonNull , an explicit null check is also generated. The constructor will throw a NullPointerException if any of...
Read more >
Update your codebase to use nullable reference types
The global nullable context does not apply for generated code files. Under either strategy, the nullable context is disabled for any source file...
Read more >
Nullable & NonNull - Medium
If any parameter is mark as @NonNull, we can stripe the null check with confidant. On the other hand, if the parameter is...
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