Skip to content

Commit 1e0ef99

Browse files
committed
Leverage @NullMarked instead of package configuration
This commit replaces NullAway package configuration by package-level `@NullMarked` detection by configuring `NullAway:AnnotatedPackages` to an empty string. NullAway configuration should be refined to use a proper flag instead once uber/NullAway#574 is fixed. See gh-28797
1 parent 528578d commit 1e0ef99

File tree

8 files changed

+4
-22
lines changed

8 files changed

+4
-22
lines changed

gradle/spring-module.gradle

+2-4
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,8 @@ tasks.withType(JavaCompile).configureEach {
117117
options.errorprone {
118118
disableAllChecks = true
119119
option("NullAway:CustomContractAnnotations", "org.springframework.lang.Contract")
120-
option("NullAway:AnnotatedPackages", "org.springframework")
121-
option("NullAway:UnannotatedSubPackages", "org.springframework.instrument,org.springframework.context.index," +
122-
"org.springframework.asm,org.springframework.cglib,org.springframework.objenesis," +
123-
"org.springframework.javapoet,org.springframework.aot.nativex.substitution,org.springframework.aot.nativex.feature")
120+
// TODO Replace by proper flag when supported, see https://github.com/uber/NullAway/issues/574
121+
option("NullAway:AnnotatedPackages", "")
124122
}
125123
}
126124
tasks.compileJava {
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/**
22
* Support for class instrumentation on GlassFish.
33
*/
4-
@NullMarked
54
package org.springframework.instrument.classloading.glassfish;
6-
7-
import org.jspecify.annotations.NullMarked;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/**
22
* Support for class instrumentation on JBoss AS 6 and 7.
33
*/
4-
@NullMarked
54
package org.springframework.instrument.classloading.jboss;
6-
7-
import org.jspecify.annotations.NullMarked;

spring-context/src/main/java/org/springframework/instrument/classloading/package-info.java

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@
22
* Support package for load time weaving based on class loaders,
33
* as required by JPA providers (but not JPA-specific).
44
*/
5-
@NullMarked
65
package org.springframework.instrument.classloading;
7-
8-
import org.jspecify.annotations.NullMarked;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/**
22
* Support for class instrumentation on Tomcat.
33
*/
4-
@NullMarked
54
package org.springframework.instrument.classloading.tomcat;
6-
7-
import org.jspecify.annotations.NullMarked;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/**
22
* GraalVM native image features, not part of Spring Framework public API.
33
*/
4-
@NullMarked
54
package org.springframework.aot.nativex.feature;
6-
7-
import org.jspecify.annotations.NullMarked;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/**
22
* GraalVM native image substitutions, not part of Spring Framework public API.
33
*/
4-
@NullMarked
54
package org.springframework.aot.nativex.substitution;
6-
7-
import org.jspecify.annotations.NullMarked;

src/checkstyle/checkstyle-suppressions.xml

+2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@
3737
<suppress files="RootBeanDefinition" checks="EqualsHashCode"/>
3838

3939
<!-- spring-context -->
40+
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]instrument[\\/]" checks="RegexpSinglelineJava" id="packageLevelNullMarkedAnnotation"/>
4041
<suppress files="SpringAtInjectTckTests" checks="IllegalImportCheck" id="bannedJUnit3Imports"/>
4142

4243
<!-- spring-core -->
4344
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/](asm|cglib|objenesis|javapoet)[\\/]" checks=".*"/>
45+
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]aot[\\/]nativex[\\/]" checks="RegexpSinglelineJava" id="packageLevelNullMarkedAnnotation"/>
4446
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]aot[\\/]nativex[\\/]feature[\\/]" checks="RegexpSinglelineJava" id="systemOutErrPrint"/>
4547
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/](core|util)[\\/](SpringProperties|SystemPropertyUtils)" checks="RegexpSinglelineJava" id="systemOutErrPrint"/>
4648
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]springframework[\\/]lang[\\/]" checks="IllegalImport" id="bannedImports" message="javax"/>

0 commit comments

Comments
 (0)