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

Add initial nullability annotations #1467

Merged
merged 4 commits into from
Dec 20, 2020
Merged

Add initial nullability annotations #1467

merged 4 commits into from
Dec 20, 2020

Conversation

jhy
Copy link
Owner

@jhy jhy commented Dec 20, 2020

Using JSR-305, which IntelliJ and Kotlin and other checkers are compatible with to annotate nullability.

Includes initial annotations for ReturnsNonnull and ParametersNonnull for Jsoup.class. Over time, the goal will be to add those to all packages, and only explicitly specify nullable returns / params / fields.

@jhy jhy linked an issue Dec 20, 2020 that may be closed by this pull request
@jhy jhy merged commit d45098e into master Dec 20, 2020
@jhy jhy deleted the annotate-nulls branch January 2, 2021 23:16
boolean seen = false;
for (Annotation annotation : declaredAnnotations) {
if (annotation.annotationType().isAssignableFrom(ParametersAreNonnullByDefault.class))
seen = true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a break can be added here

@offa
Copy link
Contributor

offa commented Oct 19, 2021

Just a marginalia: Projects like Jenkins have moved away from JSR 305 and use the spotbugs annotations instead.

The license seems not be that clear too (see findbugsproject/findbugs#128).

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

Successfully merging this pull request may close these issues.

Add @Nullable/@NotNull to API (for Kotlin, etc)
3 participants