-
Notifications
You must be signed in to change notification settings - Fork 47
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
What about @ParametersAreNonnullByDefault? #18
Comments
The same question is for |
For now, we are not planning to add them. |
@amaembo any updates on this? |
I guess the rationale for this decision was that JSR-305 already provides it and therefore there was no need to add it. In the meantime the situation has changed, though: As JetBrains is known to be very supportive of (and many times even leading) new standards, I guess it's time to reconsider. |
I found this page: https://www.jetbrains.com/help/idea/parametersarenonnullbydefault-annotation.html Does that mean it is supported now? |
No, not without said dependency which causes split packages:
|
If there no plans to add equivalent |
NotNullByDefault is added in 26.0.0 |
@amaembo are there any plans to add |
@matheusstutzel no, it's unnecessary. |
Is it unnecessary? What if you want notnull by default in |
There's no such thing as sub-packages in Java. The annotation doesn't affect any packages other than the package where it's declared. Having Nullable by default is a rare choice, as most of the APIs are notnull. Also, and complex annotation hierarchy could be confusing for API users. It's better to annotate Nullable methods explicitly, or not using NotNullByDefault at all. Alternative, you can annotate every class with NotNullByDefault, except those classes where Nullable APIs prevail. |
Does NotNullByDefault support annotating modules, so the whole module is notnull by default? |
Not yet, though we are considering this. |
Packages inside other packages are often referred to as subpackages. Also, the concept is used often in things like component scans in Spring, which scans for components in the specified package and any subpackages. It's fine though for this annotation to not apply to subpackages. Maybe one day the annotation could be expanded with a boolean |
This is not a good idea. Packages with the same prefix could be a part of another artefact, which is completely unaware of your annotation. This problem should be solved with module-level annotation. |
I created an issue for the module-level support for this annotation. Other than that, I agree that you don't want to willy nilly apply the annotation to packages with the same prefix in another module. I do believe it could be possible to only cascade down to the subpackages within the current module though. That way you would avoid that side effect. |
I think it's a great replacement for jsr-305's annotations (in the context of IntellijIdea's inspection). Would Jetbrains support that annotation?
The text was updated successfully, but these errors were encountered: