-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Ensure all packages declare package-info.java
with null-safety annotations
#30069
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
Conversation
7268cb4
to
73fa229
Compare
f6d442e
to
7d191a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the suggestion. Can you provide more details about the choices you made for checkstyle modules?
(didn't see the issue reference, which probably provides some context. my bad) |
@edyda99 I think the |
Hi @simonbasle, I will go with RegexpJavaSingleLine. |
Perhaps a simpler one line regexp like |
Done!
|
Not necessarily, if that's the only thing in the commit.
It depends on how many package-info are missing. I would locally prepare the change and run some static analysis trying to find null-safety issues raising from that change. If the build doesn't break, I'm not sure I would make it a goal of this PR to fix the null-safety warnings though. Wdyt @sbrannen (also cc @sdeleuze) |
I agree with @simonbasle. Ideally the final result will be 3-4 commits.
Of course, we may squash all commits in the PR into a single commit if that turns out to be easier.
I don't understand the question. Can you please expound?
Ensuring that proper null-safety semantics are enforced within code in newly annotated packages is beyond the scope of this PR/issue. I've created #30083 to address that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
It's coming along nicely.
I've requested a few minor changes.
After that, all that's left is ensuring that the build fails for violations and that all missing package-info.java
files have been created (so that the build passes again).
package-info.java
with null-safety annotations
You also need to suppress violations in the And for the following packages in
|
f4000a3
to
8eee8f0
Compare
…le and specific packages inside spring-core module This commit updates the project's checkstyle configuration to require the existence of a package-info.java file for all packages within the src/main directory while excluding framework-docs module and certain packages inside spring-core module. A missing package-info.java will result in emitting an exception.
…le and specific packages inside spring-core module This commit updates the project's checkstyle configuration to require the existence of a package-info.java file for all packages within the src/main directory while excluding framework-docs module and certain packages inside spring-core module. A missing package-info.java will result in emitting a warning.
…le and specific packages inside spring-core module This commit updates the project's checkstyle configuration to require the existence of a package-info.java file for all packages within the src/main directory while excluding framework-docs module and certain packages inside spring-core module. A missing package-info.java will result in emitting a warning. Additionally, two RegexpSinglelineJava modules have been added to check that package-info.java files contain null-safety annotations @NonNullApi and NonNullFields and throws exception in case one of them or both are missing.
…le and specific packages inside spring-core module This commit updates the project's checkstyle configuration to require the existence of a package-info.java file for all packages within the src/main directory while excluding framework-docs module and certain packages inside spring-core module. A missing package-info.java will result in emitting a warning. Additionally, two RegexpSinglelineJava modules have been added to check that package-info.java files contain null-safety annotations @NonNullApi and NonNullFields.
Hi again, First sorry for the continuous Force pushes, but I wanted to reduce my commits. The merge request is ready for the final review Thank you again! |
Thanks for making the latest changes, @edyda99! Except for creation of the missing While reviewing the work locally on my machine, I have discovered a few issues with regular expressions, the wrong I have therefore converted this PR to a draft to signal that I will make the final changes locally after merging in your work. |
@sbrannen Ok Great |
This commit updates the project's checkstyle configuration to require the existence of a package-info.java file for all packages within the src/main directory while excluding the framework-docs module and certain packages inside the spring-core module. A missing package-info.java file will result in emitting a warning. See gh-30069
This commit updates the project's checkstyle configuration to check that package-info.java files contain the @NonNullApi and @NonNullFields null-safety annotations. See gh-30069
We have an In light of that, you can search for existing issues that appeal to you and for which you feel qualified to tackle. Then ask on the issue if a PR would be welcome. |
Overview
This commit adds the
JavadocPackage
Checkstyle module to the project's configuration file (checkstyle.xml
). The module is configured to emit a warning message when apackage-info.java
file is missing, rather than throwing an exception. In addition, suppressions have been added to prevent theJavadocPackage
checks from being applied to packages outside of thesrc/main
directory. These suppressions ensure that the module only checks the packages that are relevant to the project and prevents false positives from being reported.Deliverables
JavadocPackage
Checkstyle module to requirepackage-info.java
files for all packages undersrc/main
.package-info.java
files include null-safety annotations – for example, via Checkstyle.package-info.java
files include null-safety annotations, configure the necessary infrastructure.package-info.java
files with package-level Javadoc and null-safety annotations.