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 Package to @NotNull and @Nullable Targets #73

Closed
wants to merge 1 commit into from
Closed

Add Package to @NotNull and @Nullable Targets #73

wants to merge 1 commit into from

Conversation

Fleshgrinder
Copy link

Closes #18, obviously support for it in IntelliJ and Kotlin would still be required.

Closes #18, obviously support for it in IntelliJ and Kotlin would still be required.
@amaembo
Copy link
Collaborator

amaembo commented Jul 18, 2022

Unfortunately, this problem is not nearly that simple as adding a couple of targets. It should be specified precisely which parts of code are covered by default annotations. Does it means that all method return types are not null? Ok, and what about all method parameters? And about fields? Including private ones? What about type arguments? What about newly declared type parameters? What about wildcard types? If the method accepts List<?> does it mean that list elements are never null? What about inferred types and lambda parameters? Should we highlight every .filter(x -> Objects.nonNull(x)) as 'condition is always true' because @NotNull on the package assumes that x parameter is never null? Next, what if we override a method of superclass and there's one annotation on superclass method but a contradicting annotation on package default. E.g., suppose that you implement a Map interface inside the package annotated as @NotNull. Does it mean that unannotated Map.get should be assumed to never return null? Sorry but adding new targets without a proper specification is a no-go.

@amaembo amaembo closed this Jul 18, 2022
@Fleshgrinder Fleshgrinder deleted the package-nullity branch August 5, 2022 15:30
@Fleshgrinder
Copy link
Author

I was hoping to start a discussion here since #18 did not receive much attention. I was not expecting such a harsh reaction. All your points are very valid and could be discussed, but if there is no interest, well, sorry for contributing I guess.

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.

What about @ParametersAreNonnullByDefault?
2 participants