google / google/error-prone

Void should be annotated @Nullable

Open
#3,792 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

There are multiple methods using `java.lang.Void` as return or parameter type, not annotated as `@Nullable`. Examples:

com.google.errorprone.bugpatterns.threadsafety.ConstantExpressions::visitIdentifier
com.google.errorprone.bugpatterns.threadsafety.ConstantExpressions::visitParenthesized
com.google.errorprone.bugpatterns.threadsafety.ConstantExpressions::visitBinary
com.google.errorprone.bugpatterns.threadsafety.DoubleCheckedLocking::vistBlock
com.google.errorprone.bugpatterns.threadsafety.ImmutableChecker::visitMemberSelect
com.google.errorprone.refaster.RefasterScanner::scan

etc

As `Void` cannot be instantiated, the respective values must be `null` and should therefore be annotated to aid static checkers, and error-prone actually contains a rule saying this:

https://errorprone.info/bugpattern/VoidMissingNullable

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.