Skip to content

Commit 99e54fe

Browse files
committed
Ensure all packages declare package-info.java with null-safety annotations
This commit picks up where the two previous commits left off. Specifically, this commit: - Removes the "severity=warning" configuration to ensure that violations actually fail the build. - Fixes regular expressions for suppressions by matching forward slashes using `[\\/]` instead of `\/`. - Moves the configuration for newly introduced checks to locations in checkstyle.xml that align with the existing organization of that file. - Renames the IDs for RegexpSinglelineJava checks from javaDocPackageNonNullApiAnnotation/javaDocPackageNonNullFieldsAnnotation to packageLevelNonNullApiAnnotation/packageLevelNonNullFieldsAnnotation, respectively, since these checks are not related to Javadoc. - Simplifies the null-safety annotation checks to match against imported annotation types, which enforces consistency across package-info.java files for the annotation declarations. - Simplifies the RegEx for JavadocPackage suppressions to only exclude packages not under src/main/java (vs src/main) and those in the framework-docs module. - Consistently suppresses all checks for the `asm`, `cglib`, `objenesis`, and `javapoet` packages in spring-core. - Adds explicit suppressions for null-safety annotations for the `lang` package in spring-core. - Adds explicit suppressions for null-safety annotations for the `org.aopalliance` package in spring-aop. - Revises the RegEx for null-safety annotation suppressions to only exclude package-info.java files not under src/main/java and additionally to exclude package-info.java files in the framework-docs module as well as those in the spring-context-indexer, spring-instrument, and spring-jcl modules. - Adds all missing package-info.java files. - Adds null-safety annotations to package-info.java files where appropriate. Closes gh-30069
1 parent 7e32f50 commit 99e54fe

File tree

22 files changed

+165
-50
lines changed

22 files changed

+165
-50
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Support for dynamic, refreshable {@link org.springframework.aop.TargetSource}
3+
* implementations for use with Spring AOP.
4+
*/
5+
@NonNullApi
6+
@NonNullFields
7+
package org.springframework.aop.target.dynamic;
8+
9+
import org.springframework.lang.NonNullApi;
10+
import org.springframework.lang.NonNullFields;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Various {@link org.springframework.aop.TargetSource} implementations for use
3+
* with Spring AOP.
4+
*/
5+
@NonNullApi
6+
@NonNullFields
7+
package org.springframework.aop.target;
8+
9+
import org.springframework.lang.NonNullApi;
10+
import org.springframework.lang.NonNullFields;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* AspectJ-based dependency injection support.
3+
*/
4+
@NonNullApi
5+
@NonNullFields
6+
package org.springframework.beans.factory.aspectj;
7+
8+
import org.springframework.lang.NonNullApi;
9+
import org.springframework.lang.NonNullFields;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* AspectJ-based caching support.
3+
*/
4+
@NonNullApi
5+
@NonNullFields
6+
package org.springframework.cache.aspectj;
7+
8+
import org.springframework.lang.NonNullApi;
9+
import org.springframework.lang.NonNullFields;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* AspectJ-based dependency injection support driven by the
3+
* {@link org.springframework.beans.factory.annotation.Configurable @Configurable}
4+
* annotation.
5+
*/
6+
@NonNullApi
7+
@NonNullFields
8+
package org.springframework.context.annotation.aspectj;
9+
10+
import org.springframework.lang.NonNullApi;
11+
import org.springframework.lang.NonNullFields;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* AspectJ-based scheduling support.
3+
*/
4+
@NonNullApi
5+
@NonNullFields
6+
package org.springframework.scheduling.aspectj;
7+
8+
import org.springframework.lang.NonNullApi;
9+
import org.springframework.lang.NonNullFields;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* AspectJ-based transaction management support.
3+
*/
4+
@NonNullApi
5+
@NonNullFields
6+
package org.springframework.transaction.aspectj;
7+
8+
import org.springframework.lang.NonNullApi;
9+
import org.springframework.lang.NonNullFields;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
/**
22
* Support package for Groovy-based bean definitions.
33
*/
4+
@NonNullApi
5+
@NonNullFields
46
package org.springframework.beans.factory.groovy;
7+
8+
import org.springframework.lang.NonNullApi;
9+
import org.springframework.lang.NonNullFields;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Core package for Spring Framework's scanned component index.
3+
*/
4+
package org.springframework.context.index.processor;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Core package for byte code instrumentation.
3+
*/
4+
package org.springframework.instrument;

0 commit comments

Comments
 (0)