Repository navigation
Migrate away from JSR305 - #5176
Conversation
The Checker framework is being pulled in by Caffeine and by Google Guava, so it's a dependency in almost all of our modules anyway. Would it make sense to use the annotations from the Checker framework instead of replacing
|
I thought about this too. If we have a transitive dependency on that through guava and caffeine anyway, I don't see a big problem using those annotations. I just wanted to avoid pulling in a heavyweight dependency like I'll update this PR with replacing the Jetbrains annotations with the ones from the Checker framework in a separate commit, then we can revert it, if we change our mind. |
|
@joschi I've now used However, the use of the annotations isn't as straightforward as using other nullness annotations, since the |
As denoted in #5136, JSR305 causes problems on Java 9+ due to reusing the
javax.annotationpackage.But the annotations from JSR305 can be replaced with annotations from other packages. NullAway states in the configuration docs, that any annotations with the names
@Nullable,@Nonnull,@NonNulland@NotNullare considered and not only those from JSR305. Therefore the annotations fromorg.jetbrains.annotationsshould be fine. (I've used Jetbrains' annotations here, since the package is much smaller thanchecker-qualor similar packages.)The annotations of the package
javax.annotation.concurrentcan be replaced by annotations from errorprone. The errorprone docs additionally state, that the JSR305@Immutableannotation is not evaluated, but the errorprone one is. So we should have an additional advantage there.The one
@NotThreadSafeannotation is replaced with jUnit's@Execution(SAME_THREAD), as it was done in #5149.