Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Checkers Framework annotations for common libraries #8

Open
abeln opened this issue Sep 24, 2018 · 1 comment
Open

Use Checkers Framework annotations for common libraries #8

abeln opened this issue Sep 24, 2018 · 1 comment

Comments

@abeln
Copy link
Owner

abeln commented Sep 24, 2018

@liufengyun writes

Currently, there are 3 well-known NonNull annotations in the Java world:

  • JSR 305 : javax.annotation.Nonnull
  • Android: @nonnull
  • CheckerFramework: @nonnull

A quick github search suggests that Android @nonnull seems to be widely adopted among Android developers.

Kotlin currently supports all known annotations (source):

JetBrains (@Nullable and @NotNull from the org.jetbrains.annotations package)
Android (com.android.annotations and android.support.annotations)
JSR-305 (javax.annotation)
CheckerFramework
FindBugs (edu.umd.cs.findbugs.annotations)
Eclipse (org.eclipse.jdt.annotation)
Lombok (lombok.NonNull).

If the Java source code has no @nonnull annotations, e.g. JDK, can we do better?

Yes. CheckerFramework recently published standard format about
external annotation database (.jaif), on August 30th, 2018:

  1. https://checkerframework.org/annotation-file-utilities/
  2. https://checkerframework.org/annotation-file-utilities/annotation-file-format.html
  3. https://github.com/typetools/annotated-libraries

A natural step is to (1) use CheckerFramework inference tools automatically generate annotation databases for Java libraries; (2) grow the databases via crowdsourcing (a more friendly DB interface required). This can be useful for JDK and widely used libraries like Guava, as the APIs are very stable.

@liufengyun
Copy link

I don't know how well CheckerFramework performs in nullness annotation inference, they do have the feature:

https://checkerframework.org/manual/#nullness-inference

It would be cool if it can generate a useful set of @nonnull annotations for JDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants