diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/GettingStartedDocumentationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/GettingStartedDocumentationTests.java index e79375ffce2..e5dcf8829ed 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/GettingStartedDocumentationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/GettingStartedDocumentationTests.java @@ -31,6 +31,7 @@ import org.springframework.boot.testsupport.gradle.testkit.GradleBuild; @ExtendWith(GradleMultiDslExtension.class) class GettingStartedDocumentationTests { + @SuppressWarnings("NullAway.Init") GradleBuild gradleBuild; // NOTE: We can't run any 'apply-plugin' tests because during a release the diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/IntegratingWithActuatorDocumentationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/IntegratingWithActuatorDocumentationTests.java index 4cf9538a2d9..d0962086013 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/IntegratingWithActuatorDocumentationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/IntegratingWithActuatorDocumentationTests.java @@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(GradleMultiDslExtension.class) class IntegratingWithActuatorDocumentationTests { + @SuppressWarnings("NullAway.Init") GradleBuild gradleBuild; @TestTemplate diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/ManagingDependenciesDocumentationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/ManagingDependenciesDocumentationTests.java index 1de6be47e96..730c21e8cc3 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/ManagingDependenciesDocumentationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/ManagingDependenciesDocumentationTests.java @@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assumptions.assumingThat; @ExtendWith(GradleMultiDslExtension.class) class ManagingDependenciesDocumentationTests { + @SuppressWarnings("NullAway.Init") GradleBuild gradleBuild; @TestTemplate diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java index cdcb297acc1..a9a3488d0ef 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java @@ -45,6 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(GradleMultiDslExtension.class) class PackagingDocumentationTests { + @SuppressWarnings("NullAway.Init") GradleBuild gradleBuild; @TestTemplate diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PublishingDocumentationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PublishingDocumentationTests.java index 9218eb28499..ebeae09b053 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PublishingDocumentationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PublishingDocumentationTests.java @@ -33,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(GradleMultiDslExtension.class) class PublishingDocumentationTests { + @SuppressWarnings("NullAway.Init") GradleBuild gradleBuild; @TestTemplate diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/RunningDocumentationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/RunningDocumentationTests.java index 272135deb6c..13ff4e17dba 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/RunningDocumentationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/RunningDocumentationTests.java @@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(GradleMultiDslExtension.class) class RunningDocumentationTests { + @SuppressWarnings("NullAway.Init") GradleBuild gradleBuild; @TestTemplate diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/package-info.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/package-info.java new file mode 100644 index 00000000000..ef1cb5f9e65 --- /dev/null +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.gradle.docs; + +import org.jspecify.annotations.NullMarked; diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleBuildFieldSetter.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleBuildFieldSetter.java index 94072dda76a..a595a1ef807 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleBuildFieldSetter.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleBuildFieldSetter.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; import org.springframework.boot.testsupport.gradle.testkit.GradleBuild; +import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; /** @@ -41,6 +42,7 @@ final class GradleBuildFieldSetter implements BeforeEachCallback { @Override public void beforeEach(ExtensionContext context) throws Exception { Field field = ReflectionUtils.findField(context.getRequiredTestClass(), "gradleBuild"); + Assert.notNull(field, "Field named gradleBuild not found in " + context.getRequiredTestClass().getName()); field.setAccessible(true); field.set(context.getRequiredTestInstance(), this.gradleBuild); diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java index 81dbd45fcb3..06ef617af10 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java @@ -20,6 +20,7 @@ import java.io.File; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -32,9 +33,9 @@ import org.springframework.util.StringUtils; */ public final class GradleProjectBuilder { - private File projectDir; + private @Nullable File projectDir; - private String name; + private @Nullable String name; private GradleProjectBuilder() { } diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/package-info.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/package-info.java new file mode 100644 index 00000000000..00b89f24a13 --- /dev/null +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.gradle.junit; + +import org.jspecify.annotations.NullMarked; diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/package-info.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/package-info.java new file mode 100644 index 00000000000..f34de40060c --- /dev/null +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.gradle; + +import org.jspecify.annotations.NullMarked; diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java index 07a87874231..bef260ab35a 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java @@ -661,7 +661,7 @@ abstract class AbstractBootArchiveIntegrationTests { "src/main/java/com/example/" + this.taskName.toLowerCase(Locale.ROOT) + "/" + name); output.mkdirs(); FileSystemUtils.copyRecursively( - new File("src/test/java/com/example/" + this.taskName.toLowerCase(Locale.ENGLISH) + "/" + name), + new File("src/test/resources/com/example/" + this.taskName.toLowerCase(Locale.ENGLISH) + "/" + name), output); } diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootRunIntegrationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootRunIntegrationTests.java index a39a8255d71..9b1325ea68c 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootRunIntegrationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootRunIntegrationTests.java @@ -160,7 +160,7 @@ class BootRunIntegrationTests { void classesFromASecondarySourceSetCanBeOnTheClasspath() throws IOException { File output = new File(this.gradleBuild.getProjectDir(), "src/secondary/java/com/example/bootrun/main"); output.mkdirs(); - FileSystemUtils.copyRecursively(new File("src/test/java/com/example/bootrun/main"), output); + FileSystemUtils.copyRecursively(new File("src/test/resources/com/example/bootrun/main"), output); BuildResult result = this.gradleBuild.build("bootRun"); BuildTask task = result.task(":bootRun"); assertThat(task).isNotNull(); @@ -203,7 +203,7 @@ class BootRunIntegrationTests { private void copyApplication(String name) throws IOException { File output = new File(this.gradleBuild.getProjectDir(), "src/main/java/com/example/bootrun/" + name); output.mkdirs(); - FileSystemUtils.copyRecursively(new File("src/test/java/com/example/bootrun/" + name), output); + FileSystemUtils.copyRecursively(new File("src/test/resources/com/example/bootrun/" + name), output); } private String canonicalPathOf(String path) throws IOException { diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootTestRunIntegrationTests.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootTestRunIntegrationTests.java index 28844b05e35..6fc0c7d47fb 100644 --- a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootTestRunIntegrationTests.java +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootTestRunIntegrationTests.java @@ -162,7 +162,7 @@ class BootTestRunIntegrationTests { private void copyApplication(String name) throws IOException { File output = new File(this.gradleBuild.getProjectDir(), "src/test/java/com/example/boottestrun/" + name); output.mkdirs(); - FileSystemUtils.copyRecursively(new File("src/test/java/com/example/boottestrun/" + name), output); + FileSystemUtils.copyRecursively(new File("src/test/resources/com/example/boottestrun/" + name), output); } private String canonicalPathOf(String path) throws IOException { diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/package-info.java b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/package-info.java new file mode 100644 index 00000000000..74ccbae002f --- /dev/null +++ b/build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.gradle.testkit; + +import org.jspecify.annotations.NullMarked; diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootjar/classpath/BootJarClasspathApplication.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootjar/classpath/BootJarClasspathApplication.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootjar/classpath/BootJarClasspathApplication.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootjar/classpath/BootJarClasspathApplication.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootjar/main/CustomMainClass.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootjar/main/CustomMainClass.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootjar/main/CustomMainClass.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootjar/main/CustomMainClass.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootrun/classpath/BootRunClasspathApplication.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootrun/classpath/BootRunClasspathApplication.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootrun/classpath/BootRunClasspathApplication.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootrun/classpath/BootRunClasspathApplication.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootrun/jvmargs/BootRunJvmArgsApplication.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootrun/jvmargs/BootRunJvmArgsApplication.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootrun/jvmargs/BootRunJvmArgsApplication.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootrun/jvmargs/BootRunJvmArgsApplication.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootrun/main/CustomMainClass.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootrun/main/CustomMainClass.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootrun/main/CustomMainClass.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootrun/main/CustomMainClass.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/boottestrun/classpath/BootTestRunClasspathApplication.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/boottestrun/classpath/BootTestRunClasspathApplication.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/boottestrun/classpath/BootTestRunClasspathApplication.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/boottestrun/classpath/BootTestRunClasspathApplication.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/boottestrun/jvmargs/BootTestRunJvmArgsApplication.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/boottestrun/jvmargs/BootTestRunJvmArgsApplication.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/boottestrun/jvmargs/BootTestRunJvmArgsApplication.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/boottestrun/jvmargs/BootTestRunJvmArgsApplication.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/boottestrun/nomain/BootTestRunNoMain.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/boottestrun/nomain/BootTestRunNoMain.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/boottestrun/nomain/BootTestRunNoMain.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/boottestrun/nomain/BootTestRunNoMain.java diff --git a/build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootwar/main/CustomMainClass.java b/build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootwar/main/CustomMainClass.java similarity index 100% rename from build-plugin/spring-boot-gradle-plugin/src/test/java/com/example/bootwar/main/CustomMainClass.java rename to build-plugin/spring-boot-gradle-plugin/src/test/resources/com/example/bootwar/main/CustomMainClass.java diff --git a/build-plugin/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/sample/package-info.java b/build-plugin/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/sample/package-info.java new file mode 100644 index 00000000000..90a5c26c9bf --- /dev/null +++ b/build-plugin/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/sample/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Sample code for testing the Maven plugin for Spring Boot. + */ +@NullMarked +package org.springframework.boot.maven.sample; + +import org.jspecify.annotations.NullMarked; diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 1ca099e6b5a..21fc777cced 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -26,6 +26,7 @@ repositories { mavenCentral() spring.mavenRepositoriesFor("${springFrameworkVersion}") gradlePluginPortal() + maven { url = "https://repo.spring.io/snapshot" } } java { diff --git a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java index fa46cb9edf2..9f51485066e 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheck.java @@ -45,7 +45,6 @@ import org.gradle.api.provider.ListProperty; import org.gradle.api.provider.MapProperty; import org.gradle.api.provider.Property; import org.gradle.api.provider.Provider; -import org.gradle.api.provider.SetProperty; import org.gradle.api.tasks.Classpath; import org.gradle.api.tasks.IgnoreEmptyDirectories; import org.gradle.api.tasks.Input; @@ -93,15 +92,9 @@ public abstract class ArchitectureCheck extends DefaultTask { getRules().addAll(whenMainSources( () -> ArchitectureRules.configurationPropertiesDeprecation(ArchitectureCheckAnnotation.classFor( getAnnotationClasses().get(), ArchitectureCheckAnnotation.DEPRECATED_CONFIGURATION_PROPERTY)))); - getRules().addAll(and(getNullMarkedEnabled(), isMainSourceSet()).map(whenTrue(() -> Collections.singletonList( - ArchitectureRules.packagesShouldBeAnnotatedWithNullMarked(getNullMarkedIgnoredPackages().get()))))); getRuleDescriptions().set(getRules().map(this::asDescriptions)); } - private Provider and(Provider provider1, Provider provider2) { - return provider1.zip(provider2, (result1, result2) -> result1 && result2); - } - private Provider> whenMainSources(Supplier> rules) { return isMainSourceSet().map(whenTrue(rules)); } @@ -211,12 +204,6 @@ public abstract class ArchitectureCheck extends DefaultTask { @Input // Use descriptions as input since rules aren't serializable abstract ListProperty getRuleDescriptions(); - @Internal - abstract Property getNullMarkedEnabled(); - - @Internal - abstract SetProperty getNullMarkedIgnoredPackages(); - @Internal abstract MapProperty getAnnotationClasses(); diff --git a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheckExtension.java b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheckExtension.java deleted file mode 100644 index 1f9ba7f1c0c..00000000000 --- a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureCheckExtension.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2012-present the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.build.architecture; - -import java.util.LinkedHashSet; - -import javax.inject.Inject; - -import org.gradle.api.Action; -import org.gradle.api.model.ObjectFactory; -import org.gradle.api.provider.Property; -import org.gradle.api.provider.SetProperty; - -/** - * Extension to configure the {@link ArchitecturePlugin}. - * - * @author Moritz Halbritter - */ -public abstract class ArchitectureCheckExtension { - - private final NullMarkedExtension nullMarked; - - @Inject - public ArchitectureCheckExtension(ObjectFactory objects) { - this.nullMarked = objects.newInstance(NullMarkedExtension.class); - } - - /** - * Get the {@code NullMarked} extension. - * @return the {@code NullMarked} extension - */ - public NullMarkedExtension getNullMarked() { - return this.nullMarked; - } - - /** - * Configure the {@code NullMarked} extension. - * @param action the action to configure the {@code NullMarked} extension with - */ - public void nullMarked(Action action) { - action.execute(this.nullMarked); - } - - /** - * Extension to configure the {@code NullMarked} extension. - */ - public abstract static class NullMarkedExtension { - - public NullMarkedExtension() { - getEnabled().convention(true); - getIgnoredPackages().convention(new LinkedHashSet<>()); - } - - /** - * Whether this project uses JSpecify's {@code NullMarked} annotations. - * @return whether this project uses JSpecify's @NullMarked annotations - */ - public abstract Property getEnabled(); - - /** - * Packages that should be ignored by the {@code NullMarked} checker. - * @return the ignored packages - */ - public abstract SetProperty getIgnoredPackages(); - - } - -} diff --git a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitecturePlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitecturePlugin.java index 88b047f52f9..bda735c6f41 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitecturePlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitecturePlugin.java @@ -16,8 +16,6 @@ package org.springframework.boot.build.architecture; -import java.util.Collections; - import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.plugins.JavaPlugin; @@ -39,30 +37,22 @@ public class ArchitecturePlugin implements Plugin { @Override public void apply(Project project) { - ArchitectureCheckExtension extension = project.getExtensions() - .create("architectureCheck", ArchitectureCheckExtension.class); - project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> registerTasks(project, extension)); + project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> registerTasks(project)); } - private void registerTasks(Project project, ArchitectureCheckExtension extension) { + private void registerTasks(Project project) { JavaPluginExtension javaPluginExtension = project.getExtensions().getByType(JavaPluginExtension.class); for (SourceSet sourceSet : javaPluginExtension.getSourceSets()) { - registerArchitectureCheck(sourceSet, "java", project).configure((task) -> { - task.setClasses(project.files(project.getTasks() + registerArchitectureCheck(sourceSet, "java", project) + .configure((task) -> task.setClasses(project.files(project.getTasks() .named(sourceSet.getCompileTaskName("java"), JavaCompile.class) - .flatMap((compile) -> compile.getDestinationDirectory()))); - task.getNullMarkedEnabled().set(extension.getNullMarked().getEnabled()); - task.getNullMarkedIgnoredPackages().set(extension.getNullMarked().getIgnoredPackages()); - }); + .flatMap((compile) -> compile.getDestinationDirectory())))); project.getPlugins() .withId("org.jetbrains.kotlin.jvm", - (kotlinPlugin) -> registerArchitectureCheck(sourceSet, "kotlin", project).configure((task) -> { - task.setClasses(project.files(project.getTasks() + (kotlinPlugin) -> registerArchitectureCheck(sourceSet, "kotlin", project) + .configure((task) -> task.setClasses(project.files(project.getTasks() .named(sourceSet.getCompileTaskName("kotlin"), KotlinCompileTool.class) - .flatMap((compile) -> compile.getDestinationDirectory()))); - task.getNullMarkedEnabled().set(false); - task.getNullMarkedIgnoredPackages().set(Collections.emptySet()); - })); + .flatMap((compile) -> compile.getDestinationDirectory()))))); } } diff --git a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureRules.java b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureRules.java index e41cbaf73c5..b96a600e43f 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureRules.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitectureRules.java @@ -284,12 +284,6 @@ final class ArchitectureRules { .allowEmptyShould(true); } - static ArchRule packagesShouldBeAnnotatedWithNullMarked(Set ignoredPackages) { - return ArchRuleDefinition.all(packages((javaPackage) -> !ignoredPackages.contains(javaPackage.getName()))) - .should(beAnnotatedWithNullMarked()) - .allowEmptyShould(true); - } - private static ArchCondition notSpecifyOnlyATypeThatIsTheSameAsTheMethodReturnType( String annotation) { return check("not specify only a type that is the same as the method's return type", (item, events) -> { @@ -587,18 +581,6 @@ final class ArchitectureRules { }; } - private static ArchCondition beAnnotatedWithNullMarked() { - return new ArchCondition<>("be annotated with @NullMarked") { - @Override - public void check(JavaPackage item, ConditionEvents events) { - if (!item.isAnnotatedWith("org.jspecify.annotations.NullMarked")) { - String message = String.format("Package %s is not annotated with @NullMarked", item.getName()); - events.add(SimpleConditionEvent.violated(item, message)); - } - } - }; - } - private static class OverridesPublicMethod extends DescribedPredicate { OverridesPublicMethod() { diff --git a/buildSrc/src/test/java/org/springframework/boot/build/architecture/ArchitectureCheckTests.java b/buildSrc/src/test/java/org/springframework/boot/build/architecture/ArchitectureCheckTests.java index 7acae3a1693..a96dbdf081d 100644 --- a/buildSrc/src/test/java/org/springframework/boot/build/architecture/ArchitectureCheckTests.java +++ b/buildSrc/src/test/java/org/springframework/boot/build/architecture/ArchitectureCheckTests.java @@ -49,7 +49,6 @@ import org.springframework.boot.build.architecture.annotations.TestConfiguration import org.springframework.boot.build.architecture.annotations.TestConfigurationPropertiesBinding; import org.springframework.boot.build.architecture.annotations.TestDeprecatedConfigurationProperty; import org.springframework.util.ClassUtils; -import org.springframework.util.CollectionUtils; import org.springframework.util.FileSystemUtils; import org.springframework.util.StringUtils; @@ -75,7 +74,7 @@ class ArchitectureCheckTests { @BeforeEach void setup(@TempDir Path projectDir) { - this.gradleBuild = new GradleBuild(projectDir).withNullMarkedEnabled(false); + this.gradleBuild = new GradleBuild(projectDir); } @ParameterizedTest(name = "{0}") @@ -380,28 +379,6 @@ class ArchitectureCheckTests { build(this.gradleBuild.withDependencies(SPRING_CONTEXT), task); } - @Test - void whenPackageIsNotAnnotatedWithNullMarkedWithMainSourcesShouldFailAndWriteEmptyReport() throws IOException { - prepareTask(Task.CHECK_ARCHITECTURE_MAIN, "nullmarked/notannotated"); - buildAndFail(this.gradleBuild.withNullMarkedEnabled(true), Task.CHECK_ARCHITECTURE_MAIN, - "Package org.springframework.boot.build.architecture.nullmarked.notannotated is not annotated with @NullMarked"); - } - - @Test - void whenPackageIsIgnoredAndNotAnnotatedWithNullMarkedWithMainSourcesShouldSucceedAndWriteEmptyReport() - throws IOException { - prepareTask(Task.CHECK_ARCHITECTURE_MAIN, "nullmarked/notannotated"); - build(this.gradleBuild.withNullMarkedEnabled(true) - .withNullMarkedIgnoredPackages("org.springframework.boot.build.architecture.nullmarked.notannotated"), - Task.CHECK_ARCHITECTURE_MAIN); - } - - @Test - void whenPackageIsNotAnnotatedWithNullMarkedWithTestSourcesShouldSucceedAndWriteEmptyReport() throws IOException { - prepareTask(Task.CHECK_ARCHITECTURE_TEST, "nullmarked/notannotated"); - build(this.gradleBuild.withNullMarkedEnabled(true), Task.CHECK_ARCHITECTURE_TEST); - } - @Test void whenEnumSourceValueIsInferredShouldSucceedAndWriteEmptyReport() throws IOException { prepareTask(Task.CHECK_ARCHITECTURE_TEST, "junit/enumsource/inferredfromparametertype"); @@ -533,8 +510,6 @@ class ArchitectureCheckTests { private final Set dependencies = new LinkedHashSet<>(); - private NullMarkedExtension nullMarkedExtension; - private final Map taskConfigurations = new LinkedHashMap<>(); private GradleBuild(Path projectDir) { @@ -583,16 +558,6 @@ class ArchitectureCheckTests { return this; } - GradleBuild withNullMarkedEnabled(Boolean enabled) { - configureNullMarkedExtension((nullMarked) -> nullMarked.withEnabled(enabled)); - return this; - } - - GradleBuild withNullMarkedIgnoredPackages(String... ignorePackages) { - configureNullMarkedExtension((nullMarked) -> nullMarked.withIgnoredPackages(ignorePackages)); - return this; - } - private void configureTasks(String annotationName, String annotationClass) { for (Task task : Task.values()) { configureTask(task, (configuration) -> configuration.withAnnotation(annotationName, annotationClass)); @@ -604,14 +569,6 @@ class ArchitectureCheckTests { this.taskConfigurations.compute(task, (key, value) -> configurer.apply(value)); } - private void configureNullMarkedExtension(UnaryOperator configurer) { - NullMarkedExtension nullMarkedExtension = this.nullMarkedExtension; - if (nullMarkedExtension == null) { - nullMarkedExtension = new NullMarkedExtension(null, null); - } - this.nullMarkedExtension = configurer.apply(nullMarkedExtension); - } - GradleBuild withDependencies(String... dependencies) { this.dependencies.clear(); this.dependencies.addAll(Arrays.asList(dependencies)); @@ -658,23 +615,6 @@ class ArchitectureCheckTests { } buildFile.append("\n}\n"); }); - NullMarkedExtension nullMarkedExtension = this.nullMarkedExtension; - if (nullMarkedExtension != null) { - buildFile.append("architectureCheck {"); - buildFile.append("\n nullMarked {"); - if (nullMarkedExtension.enabled() != null) { - buildFile.append("\n enabled = ").append(nullMarkedExtension.enabled()); - } - if (!CollectionUtils.isEmpty(nullMarkedExtension.ignoredPackages())) { - buildFile.append("\n ignoredPackages = ") - .append(nullMarkedExtension.ignoredPackages() - .stream() - .map(StringUtils::quote) - .collect(Collectors.joining(",", "[", "]"))); - } - buildFile.append("\n }"); - buildFile.append("\n}\n\n"); - } Files.writeString(this.projectDir.resolve("build.gradle"), buildFile, StandardCharsets.UTF_8); return GradleRunner.create() .withProjectDir(this.projectDir.toFile()) @@ -689,18 +629,6 @@ class ArchitectureCheckTests { .collect(Collectors.joining(", ", "[", "]")); } - private record NullMarkedExtension(Boolean enabled, Set ignoredPackages) { - - private NullMarkedExtension withEnabled(Boolean enabled) { - return new NullMarkedExtension(enabled, this.ignoredPackages); - } - - private NullMarkedExtension withIgnoredPackages(String... ignoredPackages) { - return new NullMarkedExtension(this.enabled, new LinkedHashSet<>(Arrays.asList(ignoredPackages))); - } - - } - private record TaskConfiguration(Boolean prohibitObjectsRequireNonNull, Map annotations) { public TaskConfiguration { diff --git a/cli/spring-boot-cli/build.gradle b/cli/spring-boot-cli/build.gradle index bb8b8c540a6..459c614f6bf 100644 --- a/cli/spring-boot-cli/build.gradle +++ b/cli/spring-boot-cli/build.gradle @@ -61,11 +61,8 @@ dependencies { testImplementation(project(":test-support:spring-boot-test-support")) } -architectureCheck { - nullMarked { - enabled = true - ignoredPackages = ['org.springframework.boot.cli.json'] - } +nullability { + requireExplicitNullMarking = false } tasks.register("fullJar", Jar) { diff --git a/cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/package-info.java b/cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/package-info.java new file mode 100644 index 00000000000..78715df72de --- /dev/null +++ b/cli/spring-boot-cli/src/json-shade/java/org/springframework/boot/cli/json/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullUnmarked +package org.springframework.boot.cli.json; + +import org.jspecify.annotations.NullUnmarked; diff --git a/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle b/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle index c8507cd3369..d01732ff37d 100644 --- a/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle +++ b/configuration-metadata/spring-boot-configuration-metadata-changelog-generator/build.gradle @@ -38,10 +38,8 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } def dependenciesOf(String version) { diff --git a/configuration-metadata/spring-boot-configuration-metadata/build.gradle b/configuration-metadata/spring-boot-configuration-metadata/build.gradle index bec1e28eed0..ee0946bac0a 100644 --- a/configuration-metadata/spring-boot-configuration-metadata/build.gradle +++ b/configuration-metadata/spring-boot-configuration-metadata/build.gradle @@ -35,8 +35,6 @@ dependencies { testImplementation("org.springframework:spring-core") } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } diff --git a/configuration-metadata/spring-boot-configuration-processor/build.gradle b/configuration-metadata/spring-boot-configuration-processor/build.gradle index 571497e2d0d..221d80dad9e 100644 --- a/configuration-metadata/spring-boot-configuration-processor/build.gradle +++ b/configuration-metadata/spring-boot-configuration-processor/build.gradle @@ -30,10 +30,8 @@ sourceSets { } } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } dependencies { diff --git a/core/spring-boot-autoconfigure-processor/build.gradle b/core/spring-boot-autoconfigure-processor/build.gradle index 65c09aaec2b..76c9c67adc0 100644 --- a/core/spring-boot-autoconfigure-processor/build.gradle +++ b/core/spring-boot-autoconfigure-processor/build.gradle @@ -27,8 +27,6 @@ dependencies { testImplementation(project(":test-support:spring-boot-test-support")) } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/first/package-info.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/first/package-info.java new file mode 100644 index 00000000000..274ed2b8435 --- /dev/null +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/first/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.autoconfigure.condition.config.first; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/package-info.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/package-info.java new file mode 100644 index 00000000000..f02546128df --- /dev/null +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.autoconfigure.condition.config; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/second/package-info.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/second/package-info.java new file mode 100644 index 00000000000..70acef14cae --- /dev/null +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/config/second/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.autoconfigure.condition.config.second; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/scan/package-info.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/scan/package-info.java new file mode 100644 index 00000000000..c0ef2b593d6 --- /dev/null +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/scan/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.autoconfigure.condition.scan; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/filtersample/package-info.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/filtersample/package-info.java new file mode 100644 index 00000000000..b9f89d60bcc --- /dev/null +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/filtersample/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.autoconfigure.context.filtersample; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/packagestest/one/package-info.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/packagestest/one/package-info.java new file mode 100644 index 00000000000..893ffd15848 --- /dev/null +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/packagestest/one/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.autoconfigure.packagestest.one; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/packagestest/two/package-info.java b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/packagestest/two/package-info.java new file mode 100644 index 00000000000..c4281131878 --- /dev/null +++ b/core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/packagestest/two/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.autoconfigure.packagestest.two; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/json/test/autoconfigure/app/ExampleBasicObject.java b/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/json/test/autoconfigure/app/ExampleBasicObject.java index e34bd371b6e..872e0da16f8 100644 --- a/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/json/test/autoconfigure/app/ExampleBasicObject.java +++ b/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/json/test/autoconfigure/app/ExampleBasicObject.java @@ -16,6 +16,10 @@ package org.springframework.boot.json.test.autoconfigure.app; +import java.util.Objects; + +import org.jspecify.annotations.Nullable; + /** * Example object to read/write as JSON. * @@ -23,9 +27,9 @@ package org.springframework.boot.json.test.autoconfigure.app; */ public class ExampleBasicObject { - private String value; + private @Nullable String value; - public String getValue() { + public @Nullable String getValue() { return this.value; } @@ -36,14 +40,14 @@ public class ExampleBasicObject { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { - return this.value.equals(((ExampleBasicObject) obj).value); + return Objects.equals(this.value, ((ExampleBasicObject) obj).value); } return false; } @Override public int hashCode() { - return this.value.hashCode(); + return Objects.hashCode(this.value); } } diff --git a/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/json/test/autoconfigure/app/package-info.java b/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/json/test/autoconfigure/app/package-info.java new file mode 100644 index 00000000000..3eef41d3a01 --- /dev/null +++ b/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/json/test/autoconfigure/app/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.json.test.autoconfigure.app; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/override/package-info.java b/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/override/package-info.java new file mode 100644 index 00000000000..136be41bb0f --- /dev/null +++ b/core/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/override/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.autoconfigure.override; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java index a413aac9a97..ec36df6bbce 100644 --- a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/SpringBootTestContextBootstrapperTests.java @@ -27,6 +27,7 @@ import org.springframework.test.context.MergedContextConfiguration; import org.springframework.test.context.TestContext; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.util.ReflectionTestUtils; +import org.springframework.util.Assert; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; @@ -110,7 +111,10 @@ class SpringBootTestContextBootstrapperTests { } private MergedContextConfiguration getMergedContextConfiguration(TestContext context) { - return (MergedContextConfiguration) ReflectionTestUtils.getField(context, "mergedConfig"); + MergedContextConfiguration mergedConfig = (MergedContextConfiguration) ReflectionTestUtils.getField(context, + "mergedConfig"); + Assert.notNull(mergedConfig, context + " had no MergedContextConfiguration"); + return mergedConfig; } @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/package-info.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/package-info.java new file mode 100644 index 00000000000..b4a7575bf68 --- /dev/null +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/bootstrap/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.context.bootstrap; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/duplicate/first/package-info.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/duplicate/first/package-info.java new file mode 100644 index 00000000000..fa3b3bc0d27 --- /dev/null +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/duplicate/first/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.context.example.duplicate.first; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/duplicate/second/package-info.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/duplicate/second/package-info.java new file mode 100644 index 00000000000..8d1e8211624 --- /dev/null +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/duplicate/second/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.context.example.duplicate.second; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/package-info.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/package-info.java new file mode 100644 index 00000000000..e025e51799d --- /dev/null +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.context.example; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/scan/package-info.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/scan/package-info.java new file mode 100644 index 00000000000..83ae58eeb9c --- /dev/null +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/scan/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.context.example.scan; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/scan/sub/package-info.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/scan/sub/package-info.java new file mode 100644 index 00000000000..1221f305fc4 --- /dev/null +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/example/scan/sub/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.context.example.scan.sub; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/nestedtests/package-info.java b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/nestedtests/package-info.java new file mode 100644 index 00000000000..5364f017f41 --- /dev/null +++ b/core/spring-boot-test/src/test/java/org/springframework/boot/test/context/nestedtests/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.context.nestedtests; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/annotation/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/annotation/package-info.java new file mode 100644 index 00000000000..cedf9ccb2cd --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/annotation/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.configwarnings.annotation; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/dflt/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/dflt/package-info.java new file mode 100644 index 00000000000..04c0ed2bccd --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/dflt/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.configwarnings.dflt; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/orgspring/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/orgspring/package-info.java new file mode 100644 index 00000000000..e4ae5d2ed27 --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/orgspring/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.configwarnings.orgspring; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/real/nested/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/real/nested/package-info.java new file mode 100644 index 00000000000..b32639c9435 --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/real/nested/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.configwarnings.real.nested; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/real/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/real/package-info.java new file mode 100644 index 00000000000..90bd0069e06 --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/configwarnings/real/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.configwarnings.real; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/filtersample/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/filtersample/package-info.java new file mode 100644 index 00000000000..7c1306c20bd --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/filtersample/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.filtersample; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/package-info.java new file mode 100644 index 00000000000..7af97cbb7e3 --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/test/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.properties.bind.test; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/combined/c/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/combined/c/package-info.java new file mode 100644 index 00000000000..e0e25411f6c --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/combined/c/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.properties.scan.combined.c; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/combined/d/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/combined/d/package-info.java new file mode 100644 index 00000000000..668e1512edf --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/combined/d/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.properties.scan.combined.d; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/a/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/a/package-info.java new file mode 100644 index 00000000000..704b0678d8f --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/a/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.properties.scan.valid.a; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/b/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/b/package-info.java new file mode 100644 index 00000000000..6c601829b69 --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/b/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.properties.scan.valid.b; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/package-info.java new file mode 100644 index 00000000000..7dfe2faec35 --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/context/properties/scan/valid/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.context.properties.scan.valid; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/nounique/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/nounique/package-info.java new file mode 100644 index 00000000000..6b289688610 --- /dev/null +++ b/core/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/nounique/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.diagnostics.analyzer.nounique; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/org/springframework/boot/sampleconfig/package-info.java b/core/spring-boot/src/test/java/org/springframework/boot/sampleconfig/package-info.java index 090c2c62452..7ddab728a33 100644 --- a/core/spring-boot/src/test/java/org/springframework/boot/sampleconfig/package-info.java +++ b/core/spring-boot/src/test/java/org/springframework/boot/sampleconfig/package-info.java @@ -17,4 +17,7 @@ /** * Sample config for tests */ +@NullMarked package org.springframework.boot.sampleconfig; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot/src/test/java/sampleconfig/package-info.java b/core/spring-boot/src/test/java/sampleconfig/package-info.java new file mode 100644 index 00000000000..0f8767cceba --- /dev/null +++ b/core/spring-boot/src/test/java/sampleconfig/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package sampleconfig; + +import org.jspecify.annotations.NullMarked; diff --git a/documentation/spring-boot-docs/build.gradle b/documentation/spring-boot-docs/build.gradle index 103245b83b2..e95c95d2bd2 100644 --- a/documentation/spring-boot-docs/build.gradle +++ b/documentation/spring-boot-docs/build.gradle @@ -70,10 +70,8 @@ tasks.named('compileKotlin', KotlinCompilationTask.class) { javaSources.from = [] } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } plugins.withType(EclipsePlugin) { diff --git a/gradle.properties b/gradle.properties index 3b35caf8105..29ca34bd259 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ kotlinVersion=2.2.21 mavenVersion=3.9.10 mockitoVersion=5.20.0 nativeBuildToolsVersion=0.11.3 -nullabilityPluginVersion=0.0.8 +nullabilityPluginVersion=0.0.9 snakeYamlVersion=2.5 springFrameworkVersion=7.0.2 springFramework60xVersion=6.0.23 diff --git a/loader/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/sample/package-info.java b/loader/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/sample/package-info.java new file mode 100644 index 00000000000..50d60026084 --- /dev/null +++ b/loader/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/sample/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Sample code for testing Spring Boot's loader tools. + */ +@NullMarked +package org.springframework.boot.loader.tools.sample; + +import org.jspecify.annotations.NullMarked; diff --git a/loader/spring-boot-loader/build.gradle b/loader/spring-boot-loader/build.gradle index c4305d3a407..46b5774e0bf 100644 --- a/loader/spring-boot-loader/build.gradle +++ b/loader/spring-boot-loader/build.gradle @@ -37,8 +37,6 @@ tasks.configureEach { } } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } diff --git a/module/spring-boot-batch-jdbc/src/test/java/org/springframework/boot/batch/jdbc/autoconfigure/domain/City.java b/module/spring-boot-batch-jdbc/src/test/java/org/springframework/boot/batch/jdbc/autoconfigure/domain/City.java index dedbe0e503e..23d4f7114c2 100644 --- a/module/spring-boot-batch-jdbc/src/test/java/org/springframework/boot/batch/jdbc/autoconfigure/domain/City.java +++ b/module/spring-boot-batch-jdbc/src/test/java/org/springframework/boot/batch/jdbc/autoconfigure/domain/City.java @@ -30,18 +30,23 @@ public class City implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String name; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String state; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String country; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-batch-jdbc/src/test/java/org/springframework/boot/batch/jdbc/autoconfigure/domain/package-info.java b/module/spring-boot-batch-jdbc/src/test/java/org/springframework/boot/batch/jdbc/autoconfigure/domain/package-info.java new file mode 100644 index 00000000000..a106689f116 --- /dev/null +++ b/module/spring-boot-batch-jdbc/src/test/java/org/springframework/boot/batch/jdbc/autoconfigure/domain/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.batch.jdbc.autoconfigure.domain; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-cassandra-test/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/cassandra/ExampleEntity.java b/module/spring-boot-data-cassandra-test/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/cassandra/ExampleEntity.java index 9b05c1aa84f..48a9f584be0 100644 --- a/module/spring-boot-data-cassandra-test/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/cassandra/ExampleEntity.java +++ b/module/spring-boot-data-cassandra-test/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/cassandra/ExampleEntity.java @@ -29,8 +29,10 @@ import org.springframework.data.cassandra.core.mapping.Table; public class ExampleEntity { @PrimaryKey + @SuppressWarnings("NullAway.Init") private String id; + @SuppressWarnings("NullAway.Init") private String description; public String getId() { diff --git a/module/spring-boot-data-cassandra-test/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/cassandra/package-info.java b/module/spring-boot-data-cassandra-test/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/cassandra/package-info.java new file mode 100644 index 00000000000..18165223fe9 --- /dev/null +++ b/module/spring-boot-data-cassandra-test/src/dockerTest/java/org/springframework/boot/test/autoconfigure/data/cassandra/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.test.autoconfigure.data.cassandra; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/city/City.java b/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/city/City.java index 69ccf7d3851..c5a3cf57581 100644 --- a/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/city/City.java +++ b/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/city/City.java @@ -16,6 +16,8 @@ package org.springframework.boot.data.cassandra.domain.city; +import org.jspecify.annotations.Nullable; + import org.springframework.data.cassandra.core.mapping.CassandraType; import org.springframework.data.cassandra.core.mapping.CassandraType.Name; import org.springframework.data.cassandra.core.mapping.Column; @@ -27,21 +29,21 @@ public class City { @PrimaryKey @CassandraType(type = Name.BIGINT) - private Long id; + private @Nullable Long id; @Column - private String name; + private @Nullable String name; @Column - private String state; + private @Nullable String state; @Column - private String country; + private @Nullable String country; @Column - private String map; + private @Nullable String map; - public Long getId() { + public @Nullable Long getId() { return this.id; } @@ -49,7 +51,7 @@ public class City { this.id = id; } - public String getName() { + public @Nullable String getName() { return this.name; } @@ -57,7 +59,7 @@ public class City { this.name = name; } - public String getState() { + public @Nullable String getState() { return this.state; } @@ -65,7 +67,7 @@ public class City { this.state = state; } - public String getCountry() { + public @Nullable String getCountry() { return this.country; } @@ -73,7 +75,7 @@ public class City { this.country = country; } - public String getMap() { + public @Nullable String getMap() { return this.map; } diff --git a/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/city/package-info.java b/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/city/package-info.java new file mode 100644 index 00000000000..c64895c8a93 --- /dev/null +++ b/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.cassandra.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/empty/package-info.java b/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/empty/package-info.java new file mode 100644 index 00000000000..d37e22b8459 --- /dev/null +++ b/module/spring-boot-data-cassandra/src/test/java/org/springframework/boot/data/cassandra/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.cassandra.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-commons/src/test/java/org/springframework/boot/data/domain/city/City.java b/module/spring-boot-data-commons/src/test/java/org/springframework/boot/data/domain/city/City.java index 9e248ee4c57..469b00a1427 100644 --- a/module/spring-boot-data-commons/src/test/java/org/springframework/boot/data/domain/city/City.java +++ b/module/spring-boot-data-commons/src/test/java/org/springframework/boot/data/domain/city/City.java @@ -16,12 +16,14 @@ package org.springframework.boot.data.domain.city; +import org.jspecify.annotations.Nullable; + import org.springframework.data.annotation.Id; public class City { @Id - private Long id; + private @Nullable Long id; private String name; diff --git a/module/spring-boot-data-commons/src/test/java/org/springframework/boot/data/domain/city/package-info.java b/module/spring-boot-data-commons/src/test/java/org/springframework/boot/data/domain/city/package-info.java new file mode 100644 index 00000000000..82b81404066 --- /dev/null +++ b/module/spring-boot-data-commons/src/test/java/org/springframework/boot/data/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/city/City.java b/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/city/City.java index cf1f05e7f23..857abbd97a7 100644 --- a/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/city/City.java +++ b/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/city/City.java @@ -16,6 +16,8 @@ package org.springframework.boot.data.couchbase.domain.city; +import org.jspecify.annotations.Nullable; + import org.springframework.data.annotation.Id; import org.springframework.data.couchbase.core.mapping.Document; import org.springframework.data.couchbase.core.mapping.Field; @@ -24,9 +26,9 @@ import org.springframework.data.couchbase.core.mapping.Field; public class City { @Id - private String id; + private @Nullable String id; @Field - private String name; + private @Nullable String name; } diff --git a/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/city/package-info.java b/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/city/package-info.java new file mode 100644 index 00000000000..fc760545eca --- /dev/null +++ b/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.couchbase.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/empty/package-info.java b/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/empty/package-info.java new file mode 100644 index 00000000000..2576f1f15a5 --- /dev/null +++ b/module/spring-boot-data-couchbase/src/test/java/org/springframework/boot/data/couchbase/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.couchbase.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-elasticsearch/src/dockerTest/java/org/springframework/boot/data/elasticsearch/domain/empty/package-info.java b/module/spring-boot-data-elasticsearch/src/dockerTest/java/org/springframework/boot/data/elasticsearch/domain/empty/package-info.java new file mode 100644 index 00000000000..e069b838e5b --- /dev/null +++ b/module/spring-boot-data-elasticsearch/src/dockerTest/java/org/springframework/boot/data/elasticsearch/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.elasticsearch.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-elasticsearch/src/test/java/org/springframework/boot/data/elasticsearch/domain/city/City.java b/module/spring-boot-data-elasticsearch/src/test/java/org/springframework/boot/data/elasticsearch/domain/city/City.java index cbce6806c29..372bbd0fd92 100644 --- a/module/spring-boot-data-elasticsearch/src/test/java/org/springframework/boot/data/elasticsearch/domain/city/City.java +++ b/module/spring-boot-data-elasticsearch/src/test/java/org/springframework/boot/data/elasticsearch/domain/city/City.java @@ -29,14 +29,19 @@ public class City implements Serializable { private static final long serialVersionUID = 1L; @Id + @SuppressWarnings("NullAway.Init") private Long id; + @SuppressWarnings("NullAway.Init") private String name; + @SuppressWarnings("NullAway.Init") private String state; + @SuppressWarnings("NullAway.Init") private String country; + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-data-elasticsearch/src/test/java/org/springframework/boot/data/elasticsearch/domain/city/package-info.java b/module/spring-boot-data-elasticsearch/src/test/java/org/springframework/boot/data/elasticsearch/domain/city/package-info.java new file mode 100644 index 00000000000..1d2b72b38a6 --- /dev/null +++ b/module/spring-boot-data-elasticsearch/src/test/java/org/springframework/boot/data/elasticsearch/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.elasticsearch.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/city/City.java b/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/city/City.java index 07a33df8191..37fbcddbde6 100644 --- a/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/city/City.java +++ b/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/city/City.java @@ -23,14 +23,19 @@ import org.springframework.data.relational.core.mapping.Table; public class City { @Id + @SuppressWarnings("NullAway.Init") private Long id; + @SuppressWarnings("NullAway.Init") private String name; + @SuppressWarnings("NullAway.Init") private String state; + @SuppressWarnings("NullAway.Init") private String country; + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/city/package-info.java b/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/city/package-info.java new file mode 100644 index 00000000000..66011d1e95c --- /dev/null +++ b/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.jdbc.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/empty/package-info.java b/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/empty/package-info.java new file mode 100644 index 00000000000..1b895440937 --- /dev/null +++ b/module/spring-boot-data-jdbc/src/test/java/org/springframework/boot/data/jdbc/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.jdbc.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/city/City.java b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/city/City.java index 8fb40e76eb5..8504a67a15b 100644 --- a/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/city/City.java +++ b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/city/City.java @@ -30,18 +30,23 @@ public class City implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String name; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String state; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String country; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/city/package-info.java b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/city/package-info.java new file mode 100644 index 00000000000..4d541221c1a --- /dev/null +++ b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.jpa.autoconfigure.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/country/Country.java b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/country/Country.java index 8b241745130..b3e45d3da39 100644 --- a/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/country/Country.java +++ b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/country/Country.java @@ -31,10 +31,12 @@ public class Country implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; @Audited @Column + @SuppressWarnings("NullAway.Init") private String name; public Long getId() { diff --git a/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/country/package-info.java b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/country/package-info.java new file mode 100644 index 00000000000..891ee225ce9 --- /dev/null +++ b/module/spring-boot-data-jpa/src/test/java/org/springframework/boot/data/jpa/autoconfigure/domain/country/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.jpa.autoconfigure.domain.country; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/empty/package-info.java b/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/empty/package-info.java new file mode 100644 index 00000000000..143ccb527f8 --- /dev/null +++ b/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.ldap.autoconfigure.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/person/Person.java b/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/person/Person.java index 43155f364c8..4f22e4ae81e 100644 --- a/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/person/Person.java +++ b/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/person/Person.java @@ -18,6 +18,8 @@ package org.springframework.boot.data.ldap.autoconfigure.domain.person; import javax.naming.Name; +import org.jspecify.annotations.Nullable; + import org.springframework.ldap.odm.annotations.Attribute; import org.springframework.ldap.odm.annotations.DnAttribute; import org.springframework.ldap.odm.annotations.Entry; @@ -27,10 +29,10 @@ import org.springframework.ldap.odm.annotations.Id; public class Person { @Id - private Name dn; + private @Nullable Name dn; @Attribute(name = "cn") @DnAttribute(value = "cn", index = 1) - private String fullName; + private @Nullable String fullName; } diff --git a/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/person/package-info.java b/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/person/package-info.java new file mode 100644 index 00000000000..f2af021be63 --- /dev/null +++ b/module/spring-boot-data-ldap/src/test/java/org/springframework/boot/data/ldap/autoconfigure/domain/person/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.ldap.autoconfigure.domain.person; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/alt/package-info.java b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/alt/package-info.java new file mode 100644 index 00000000000..18a57bffc95 --- /dev/null +++ b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/alt/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.mongodb.alt; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/city/City.java b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/city/City.java index c515be7dcd3..14924c0e15d 100644 --- a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/city/City.java +++ b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/city/City.java @@ -25,12 +25,16 @@ public class City implements Serializable { private static final long serialVersionUID = 1L; + @SuppressWarnings("NullAway.Init") private String name; + @SuppressWarnings("NullAway.Init") private String state; + @SuppressWarnings("NullAway.Init") private String country; + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/city/package-info.java b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/city/package-info.java new file mode 100644 index 00000000000..5f08a4a9a44 --- /dev/null +++ b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.mongodb.autoconfigure.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/country/Country.java b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/country/Country.java index a4f90f9a3ef..811640c1695 100644 --- a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/country/Country.java +++ b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/country/Country.java @@ -25,6 +25,7 @@ public class Country implements Serializable { private static final long serialVersionUID = 1L; + @SuppressWarnings("NullAway.Init") private String name; protected Country() { diff --git a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/country/package-info.java b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/country/package-info.java new file mode 100644 index 00000000000..a26a053cfc4 --- /dev/null +++ b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/domain/country/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.mongodb.autoconfigure.domain.country; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/empty/package-info.java b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/empty/package-info.java new file mode 100644 index 00000000000..f1760665f64 --- /dev/null +++ b/module/spring-boot-data-mongodb/src/test/java/org/springframework/boot/data/mongodb/autoconfigure/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.mongodb.autoconfigure.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/city/City.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/city/City.java index bffeeaffe7f..0dd8e11755e 100644 --- a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/city/City.java +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/city/City.java @@ -30,14 +30,19 @@ public class City implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; + @SuppressWarnings("NullAway.Init") private final String name; + @SuppressWarnings("NullAway.Init") private String state; + @SuppressWarnings("NullAway.Init") private final Country country; + @SuppressWarnings("NullAway.Init") private String map; public City(String name, Country country) { diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/city/package-info.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/city/package-info.java new file mode 100644 index 00000000000..a08eac18fc5 --- /dev/null +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.neo4j.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/country/Country.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/country/Country.java index bda9f463fca..886e629ac3c 100644 --- a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/country/Country.java +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/country/Country.java @@ -29,6 +29,7 @@ public class Country implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; private final String name; diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/country/package-info.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/country/package-info.java new file mode 100644 index 00000000000..22679382954 --- /dev/null +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/country/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.neo4j.domain.country; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/empty/package-info.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/empty/package-info.java new file mode 100644 index 00000000000..25e30f1bb4d --- /dev/null +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.neo4j.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNode.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNode.java index 860ac7e1d94..df64a59ecc2 100644 --- a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNode.java +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNode.java @@ -25,6 +25,7 @@ public class TestNode { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; } diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNonAnnotated.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNonAnnotated.java index dd517239afe..5ffa18e7c8e 100644 --- a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNonAnnotated.java +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestNonAnnotated.java @@ -23,6 +23,7 @@ public class TestNonAnnotated { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; } diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestPersistent.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestPersistent.java index 597f531a09a..b36840d0e0c 100644 --- a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestPersistent.java +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestPersistent.java @@ -25,6 +25,7 @@ public class TestPersistent { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; } diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestRelationshipProperties.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestRelationshipProperties.java index 073ef314fef..2f22ffa27b0 100644 --- a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestRelationshipProperties.java +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/TestRelationshipProperties.java @@ -25,6 +25,7 @@ public class TestRelationshipProperties { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") Long id; } diff --git a/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/package-info.java b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/package-info.java new file mode 100644 index 00000000000..7a5885556d1 --- /dev/null +++ b/module/spring-boot-data-neo4j/src/test/java/org/springframework/boot/data/neo4j/domain/scan/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.neo4j.domain.scan; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/city/City.java b/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/city/City.java index 770f5363dba..21cf86d41f1 100644 --- a/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/city/City.java +++ b/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/city/City.java @@ -23,14 +23,19 @@ import org.springframework.data.relational.core.mapping.Table; public class City { @Id + @SuppressWarnings("NullAway.Init") private Long id; + @SuppressWarnings("NullAway.Init") private String name; + @SuppressWarnings("NullAway.Init") private String state; + @SuppressWarnings("NullAway.Init") private String country; + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/city/package-info.java b/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/city/package-info.java new file mode 100644 index 00000000000..67201383c56 --- /dev/null +++ b/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.r2dbc.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/empty/package-info.java b/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/empty/package-info.java new file mode 100644 index 00000000000..794b26d644d --- /dev/null +++ b/module/spring-boot-data-r2dbc/src/test/java/org/springframework/boot/data/r2dbc/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.r2dbc.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/city/City.java b/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/city/City.java index 80d6921e651..92ea6b95768 100644 --- a/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/city/City.java +++ b/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/city/City.java @@ -27,14 +27,19 @@ public class City implements Serializable { private static final long serialVersionUID = 1L; @Id + @SuppressWarnings("NullAway.Init") private Long id; + @SuppressWarnings("NullAway.Init") private String name; + @SuppressWarnings("NullAway.Init") private String state; + @SuppressWarnings("NullAway.Init") private String country; + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/city/package-info.java b/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/city/package-info.java new file mode 100644 index 00000000000..474c35cd2ca --- /dev/null +++ b/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.redis.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/empty/package-info.java b/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/empty/package-info.java new file mode 100644 index 00000000000..7556f961126 --- /dev/null +++ b/module/spring-boot-data-redis/src/test/java/org/springframework/boot/data/redis/domain/empty/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.redis.domain.empty; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/domain/city/City.java b/module/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/domain/city/City.java index 82a993fb8cb..8936b1c67f9 100644 --- a/module/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/domain/city/City.java +++ b/module/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/domain/city/City.java @@ -30,18 +30,23 @@ public class City implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String name; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String state; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String country; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/domain/city/package-info.java b/module/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/domain/city/package-info.java new file mode 100644 index 00000000000..fc2a0cd5b23 --- /dev/null +++ b/module/spring-boot-data-rest/src/test/java/org/springframework/boot/data/rest/domain/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.data.rest.domain.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-devtools/src/intTest/java/com/example/package-info.java b/module/spring-boot-devtools/src/intTest/java/com/example/package-info.java new file mode 100644 index 00000000000..a4b5fb20fcd --- /dev/null +++ b/module/spring-boot-devtools/src/intTest/java/com/example/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package com.example; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java index e44aebb632d..0a3f8607d18 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/AbstractDevToolsIntegrationTests.java @@ -27,11 +27,13 @@ import net.bytebuddy.description.modifier.Visibility; import net.bytebuddy.dynamic.DynamicType; import net.bytebuddy.implementation.FixedValue; import org.awaitility.Awaitility; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.testsupport.BuildOutput; +import org.springframework.util.Assert; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -50,32 +52,39 @@ abstract class AbstractDevToolsIntegrationTests { protected final JvmLauncher javaLauncher = new JvmLauncher(); @TempDir + @SuppressWarnings("NullAway.Init") protected static File temp; - protected LaunchedApplication launchedApplication; + private @Nullable LaunchedApplication launchedApplication; - protected void launchApplication(ApplicationLauncher applicationLauncher, String... args) throws Exception { + protected LaunchedApplication launchApplication(ApplicationLauncher applicationLauncher, String... args) + throws Exception { this.serverPortFile.delete(); this.launchedApplication = applicationLauncher.launchApplication(this.javaLauncher, this.serverPortFile, args); + return this.launchedApplication; } @AfterEach void stopApplication() throws InterruptedException { + Assert.notNull(this.launchedApplication, "Application has not been launched"); this.launchedApplication.stop(); } protected int awaitServerPort() throws Exception { + LaunchedApplication launchedApplication = this.launchedApplication; + Assert.notNull(launchedApplication, "Application has not been launched"); int port = Awaitility.waitAtMost(Duration.ofMinutes(3)) - .until(() -> new ApplicationState(this.serverPortFile, this.launchedApplication), + .until(() -> new ApplicationState(this.serverPortFile, launchedApplication), ApplicationState::hasServerPort) .getServerPort(); this.serverPortFile.delete(); - this.launchedApplication.restartRemote(port); + launchedApplication.restartRemote(port); Thread.sleep(1000); return port; } protected ControllerBuilder controller(String name) { + Assert.notNull(this.launchedApplication, "Application has not been launched"); return new ControllerBuilder(name, this.launchedApplication.getClassesDirectory()); } diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/ApplicationState.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/ApplicationState.java index 4d128f7cfaa..8e445307229 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/ApplicationState.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/ApplicationState.java @@ -19,7 +19,10 @@ package org.springframework.boot.devtools.tests; import java.io.File; import java.time.Instant; +import org.jspecify.annotations.Nullable; + import org.springframework.boot.devtools.tests.JvmLauncher.LaunchedJvm; +import org.springframework.util.Assert; /** * State of an application. @@ -30,7 +33,7 @@ final class ApplicationState { private final Instant launchTime; - private final Integer serverPort; + private final @Nullable Integer serverPort; private final FileContents out; @@ -56,6 +59,7 @@ final class ApplicationState { } int getServerPort() { + Assert.notNull(this.serverPort, "No server port is available"); return this.serverPort; } diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index 05dcbba4a51..f6752a3780c 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -125,10 +125,10 @@ class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests { @ParameterizedTest(name = "{0}") @MethodSource("parameters") void deleteAController(ApplicationLauncher applicationLauncher) throws Exception { - launchApplication(applicationLauncher); + LaunchedApplication launchedApplication = launchApplication(applicationLauncher); String urlBase = "http://localhost:" + awaitServerPort(); assertThat(this.template.getForObject(urlBase + "/one", String.class)).isEqualTo("one"); - assertThat(new File(this.launchedApplication.getClassesDirectory(), "com/example/ControllerOne.class").delete()) + assertThat(new File(launchedApplication.getClassesDirectory(), "com/example/ControllerOne.class").delete()) .isTrue(); urlBase = "http://localhost:" + awaitServerPort(); assertThat(this.template.getForEntity(urlBase + "/one", String.class).getStatusCode()) @@ -139,7 +139,7 @@ class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests { @ParameterizedTest(name = "{0}") @MethodSource("parameters") void createAControllerAndThenDeleteIt(ApplicationLauncher applicationLauncher) throws Exception { - launchApplication(applicationLauncher); + LaunchedApplication launchedApplication = launchApplication(applicationLauncher); String urlBase = "http://localhost:" + awaitServerPort(); assertThat(this.template.getForObject(urlBase + "/one", String.class)).isEqualTo("one"); assertThat(this.template.getForEntity(urlBase + "/two", String.class).getStatusCode()) @@ -148,7 +148,7 @@ class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests { urlBase = "http://localhost:" + awaitServerPort(); assertThat(this.template.getForObject(urlBase + "/one", String.class)).isEqualTo("one"); assertThat(this.template.getForObject(urlBase + "/two", String.class)).isEqualTo("two"); - assertThat(new File(this.launchedApplication.getClassesDirectory(), "com/example/ControllerTwo.class").delete()) + assertThat(new File(launchedApplication.getClassesDirectory(), "com/example/ControllerTwo.class").delete()) .isTrue(); urlBase = "http://localhost:" + awaitServerPort(); assertThat(this.template.getForEntity(urlBase + "/two", String.class).getStatusCode()) diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/FileContents.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/FileContents.java index b4359d03f7f..3330e9f9f4a 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/FileContents.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/FileContents.java @@ -21,6 +21,8 @@ import java.io.FileReader; import java.io.IOException; import java.util.function.Function; +import org.jspecify.annotations.Nullable; + import org.springframework.util.FileCopyUtils; /** @@ -36,11 +38,11 @@ class FileContents { this.file = file; } - String get() { + @Nullable String get() { return get(Function.identity()); } - T get(Function transformer) { + @Nullable T get(Function transformer) { if ((!this.file.exists()) || this.file.length() == 0) { return null; } @@ -53,7 +55,7 @@ class FileContents { } @Override - public String toString() { + public @Nullable String toString() { return get(); } diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/JvmLauncher.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/JvmLauncher.java index 45794ea6ed4..bd47bf7a620 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/JvmLauncher.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/JvmLauncher.java @@ -24,6 +24,7 @@ import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.extension.BeforeTestExecutionCallback; import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; @@ -43,7 +44,7 @@ class JvmLauncher implements BeforeTestExecutionCallback { private final BuildOutput buildOutput = new BuildOutput(getClass()); - private File outputDirectory; + private @Nullable File outputDirectory; @Override public void beforeTestExecution(ExtensionContext context) throws Exception { diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/LaunchedApplication.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/LaunchedApplication.java index 2cae5d31c28..aaca660a3ed 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/LaunchedApplication.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/LaunchedApplication.java @@ -20,6 +20,8 @@ import java.io.File; import java.time.Instant; import java.util.function.BiFunction; +import org.jspecify.annotations.Nullable; + /** * An application launched by {@link ApplicationLauncher}. * @@ -35,14 +37,14 @@ class LaunchedApplication { private final Process localProcess; - private Process remoteProcess; + private @Nullable Process remoteProcess; private final Instant launchTime = Instant.now(); - private final BiFunction remoteProcessRestarter; + private final @Nullable BiFunction remoteProcessRestarter; LaunchedApplication(File classesDirectory, File standardOut, File standardError, Process localProcess, - Process remoteProcess, BiFunction remoteProcessRestarter) { + @Nullable Process remoteProcess, @Nullable BiFunction remoteProcessRestarter) { this.classesDirectory = classesDirectory; this.standardOut = standardOut; this.standardError = standardError; @@ -63,7 +65,7 @@ class LaunchedApplication { stop(this.remoteProcess); } - private void stop(Process process) throws InterruptedException { + private void stop(@Nullable Process process) throws InterruptedException { if (process != null) { process.destroy(); process.waitFor(); diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/package-info.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/package-info.java new file mode 100644 index 00000000000..36e93201111 --- /dev/null +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.devtools.tests; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java b/module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java index 39e8d5bce32..3a68e1793e8 100644 --- a/module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java +++ b/module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java @@ -24,6 +24,8 @@ import java.util.Deque; import java.util.List; import java.util.concurrent.atomic.AtomicLong; +import org.jspecify.annotations.Nullable; + import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -105,11 +107,11 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory { private final int delay; - private final byte[] payload; + private final byte @Nullable [] payload; private final HttpStatus status; - Response(int delay, byte[] payload, HttpStatus status) { + Response(int delay, byte @Nullable [] payload, HttpStatus status) { this.delay = delay; this.payload = payload; this.status = status; diff --git a/module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/package-info.java b/module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/package-info.java new file mode 100644 index 00000000000..c4fd724a98b --- /dev/null +++ b/module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.devtools.test; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-devtools/src/test/java/org/springframework/boot/loader/launch/FakeJarLauncher.java b/module/spring-boot-devtools/src/test/java/org/springframework/boot/loader/launch/FakeJarLauncher.java index d5d2010526c..869d4003f17 100644 --- a/module/spring-boot-devtools/src/test/java/org/springframework/boot/loader/launch/FakeJarLauncher.java +++ b/module/spring-boot-devtools/src/test/java/org/springframework/boot/loader/launch/FakeJarLauncher.java @@ -18,6 +18,8 @@ package org.springframework.boot.loader.launch; import java.util.function.Consumer; +import org.jspecify.annotations.Nullable; + /** * Fake launcher in the {@code org.springframework.boot.loader.launch} package used in * {@code MainMethodTests}. @@ -26,13 +28,15 @@ import java.util.function.Consumer; */ public final class FakeJarLauncher { - public static Consumer action; + public static @Nullable Consumer action; private FakeJarLauncher() { } public static void main(String... args) { - action.accept(args); + if (action != null) { + action.accept(args); + } } } diff --git a/module/spring-boot-devtools/src/test/java/org/springframework/boot/loader/launch/package-info.java b/module/spring-boot-devtools/src/test/java/org/springframework/boot/loader/launch/package-info.java new file mode 100644 index 00000000000..19b368b86d1 --- /dev/null +++ b/module/spring-boot-devtools/src/test/java/org/springframework/boot/loader/launch/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.loader.launch; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/app/ExampleBasicObject.java b/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/app/ExampleBasicObject.java index 6efe32bee27..e3510630482 100644 --- a/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/app/ExampleBasicObject.java +++ b/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/app/ExampleBasicObject.java @@ -16,6 +16,10 @@ package org.springframework.boot.gson.autoconfigure.jsontest.app; +import java.util.Objects; + +import org.jspecify.annotations.Nullable; + /** * Example object to read/write as JSON. * @@ -23,9 +27,9 @@ package org.springframework.boot.gson.autoconfigure.jsontest.app; */ public class ExampleBasicObject { - private String value; + private @Nullable String value; - public String getValue() { + public @Nullable String getValue() { return this.value; } @@ -36,14 +40,14 @@ public class ExampleBasicObject { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { - return this.value.equals(((ExampleBasicObject) obj).value); + return Objects.equals(this.value, ((ExampleBasicObject) obj).value); } return false; } @Override public int hashCode() { - return this.value.hashCode(); + return Objects.hashCode(this.value); } } diff --git a/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/app/package-info.java b/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/app/package-info.java new file mode 100644 index 00000000000..10b6fbf6165 --- /dev/null +++ b/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/app/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.gson.autoconfigure.jsontest.app; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/package-info.java b/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/package-info.java new file mode 100644 index 00000000000..9c2a53122ef --- /dev/null +++ b/module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/jsontest/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.gson.autoconfigure.jsontest; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/mapping/NonAnnotatedEntity.java b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/mapping/NonAnnotatedEntity.java index 8ab276b31bc..262615823d0 100644 --- a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/mapping/NonAnnotatedEntity.java +++ b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/mapping/NonAnnotatedEntity.java @@ -23,8 +23,10 @@ package org.springframework.boot.hibernate.autoconfigure.mapping; */ public class NonAnnotatedEntity { + @SuppressWarnings("NullAway.Init") private Long id; + @SuppressWarnings("NullAway.Init") private String item; protected NonAnnotatedEntity() { diff --git a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/mapping/package-info.java b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/mapping/package-info.java new file mode 100644 index 00000000000..c1fb1cc38e5 --- /dev/null +++ b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/mapping/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.hibernate.autoconfigure.mapping; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/City.java b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/City.java index ff8ae32e95b..5a00f25a734 100644 --- a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/City.java +++ b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/City.java @@ -32,18 +32,23 @@ public class City implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String name; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String state; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String country; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/CityListener.java b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/CityListener.java index 06f4fe8eca1..c4e2e323969 100644 --- a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/CityListener.java +++ b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/CityListener.java @@ -17,13 +17,14 @@ package org.springframework.boot.hibernate.autoconfigure.test.city; import jakarta.persistence.PostLoad; +import org.jspecify.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; public class CityListener { - private ConfigurableBeanFactory beanFactory; + private @Nullable ConfigurableBeanFactory beanFactory; public CityListener() { } diff --git a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/package-info.java b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/package-info.java new file mode 100644 index 00000000000..57a35c7608c --- /dev/null +++ b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/city/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.hibernate.autoconfigure.test.city; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/country/Country.java b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/country/Country.java index 6c78085f642..497c580b2b6 100644 --- a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/country/Country.java +++ b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/country/Country.java @@ -31,10 +31,12 @@ public class Country implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; @Audited @Column + @SuppressWarnings("NullAway.Init") private String name; public Long getId() { diff --git a/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/country/package-info.java b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/country/package-info.java new file mode 100644 index 00000000000..afc9914d3b4 --- /dev/null +++ b/module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/test/country/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.hibernate.autoconfigure.test.country; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleBasicObject.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleBasicObject.java index bacea6cd135..a22af95a22c 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleBasicObject.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleBasicObject.java @@ -16,6 +16,10 @@ package org.springframework.boot.jackson.autoconfigure.jsontest.app; +import java.util.Objects; + +import org.jspecify.annotations.Nullable; + /** * Example object to read/write as JSON. * @@ -23,9 +27,9 @@ package org.springframework.boot.jackson.autoconfigure.jsontest.app; */ public class ExampleBasicObject { - private String value; + private @Nullable String value; - public String getValue() { + public @Nullable String getValue() { return this.value; } @@ -36,14 +40,14 @@ public class ExampleBasicObject { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { - return this.value.equals(((ExampleBasicObject) obj).value); + return Objects.equals(this.value, ((ExampleBasicObject) obj).value); } return false; } @Override public int hashCode() { - return this.value.hashCode(); + return Objects.hashCode(this.value); } } diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleCustomObject.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleCustomObject.java index 2064863a05e..1c71a20935f 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleCustomObject.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleCustomObject.java @@ -19,6 +19,8 @@ package org.springframework.boot.jackson.autoconfigure.jsontest.app; import java.util.Date; import java.util.UUID; +import org.jspecify.annotations.Nullable; + /** * Example object to read/write as JSON through {@link ExampleJacksonComponent}. * @@ -27,6 +29,6 @@ import java.util.UUID; * @param date a date * @param uuid a uuid */ -public record ExampleCustomObject(String value, Date date, UUID uuid) { +public record ExampleCustomObject(@Nullable String value, @Nullable Date date, @Nullable UUID uuid) { } diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJacksonComponent.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJacksonComponent.java index e5ad89667d2..bfce0b131e8 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJacksonComponent.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJacksonComponent.java @@ -19,6 +19,7 @@ package org.springframework.boot.jackson.autoconfigure.jsontest.app; import java.util.Date; import java.util.UUID; +import org.jspecify.annotations.Nullable; import tools.jackson.core.JsonGenerator; import tools.jackson.core.JsonParser; import tools.jackson.databind.DeserializationContext; @@ -44,8 +45,14 @@ public class ExampleJacksonComponent { @Override protected void serializeObject(ExampleCustomObject value, JsonGenerator jgen, SerializationContext context) { jgen.writeStringProperty("value", value.value()); - jgen.writeNumberProperty("date", value.date().getTime()); - jgen.writeStringProperty("uuid", value.uuid().toString()); + @Nullable Date date = value.date(); + if (date != null) { + jgen.writeNumberProperty("date", date.getTime()); + } + @Nullable UUID uuid = value.uuid(); + if (uuid != null) { + jgen.writeStringProperty("uuid", uuid.toString()); + } } } diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJsonObjectWithView.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJsonObjectWithView.java index 36d2c4f2e1c..cd897b47598 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJsonObjectWithView.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/ExampleJsonObjectWithView.java @@ -17,6 +17,7 @@ package org.springframework.boot.jackson.autoconfigure.jsontest.app; import com.fasterxml.jackson.annotation.JsonView; +import org.jspecify.annotations.Nullable; import org.springframework.util.ObjectUtils; @@ -28,11 +29,11 @@ import org.springframework.util.ObjectUtils; public class ExampleJsonObjectWithView { @JsonView(TestView.class) - private String value; + private @Nullable String value; private int id; - public String getValue() { + public @Nullable String getValue() { return this.value; } diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/package-info.java new file mode 100644 index 00000000000..afed687f1be --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/app/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.autoconfigure.jsontest.app; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/package-info.java new file mode 100644 index 00000000000..6ff96a5c4e6 --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/autoconfigure/jsontest/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.autoconfigure.jsontest; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/a/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/a/package-info.java new file mode 100644 index 00000000000..1761d121bed --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/a/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.scan.a; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/b/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/b/package-info.java new file mode 100644 index 00000000000..60d8ac7b30a --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/b/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.scan.b; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/c/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/c/package-info.java new file mode 100644 index 00000000000..8b6605a673c --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/c/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.scan.c; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/d/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/d/package-info.java new file mode 100644 index 00000000000..d3f1cfa59fe --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/d/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.scan.d; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/e/PrivateMixInClass.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/e/PrivateMixInClass.java index 90e5050ec0f..b650ae411f0 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/e/PrivateMixInClass.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/e/PrivateMixInClass.java @@ -17,6 +17,7 @@ package org.springframework.boot.jackson.scan.e; import com.fasterxml.jackson.annotation.JsonProperty; +import org.jspecify.annotations.Nullable; import org.springframework.boot.jackson.JacksonMixin; import org.springframework.boot.jackson.types.Name; @@ -26,7 +27,7 @@ import org.springframework.boot.jackson.types.NameAndAge; class PrivateMixInClass { @JsonProperty("username") - String getName() { + @Nullable String getName() { return null; } diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/e/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/e/package-info.java new file mode 100644 index 00000000000..bb8823a91eb --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/e/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.scan.e; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/f/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/f/package-info.java new file mode 100644 index 00000000000..a7f3293bf17 --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/scan/f/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.scan.f; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/types/NameAndCareer.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/types/NameAndCareer.java index f778d5cde04..69375998279 100644 --- a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/types/NameAndCareer.java +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/types/NameAndCareer.java @@ -16,6 +16,8 @@ package org.springframework.boot.jackson.types; +import org.jspecify.annotations.Nullable; + /** * Sample object used for tests. * @@ -23,14 +25,14 @@ package org.springframework.boot.jackson.types; */ public class NameAndCareer extends Name { - private final String career; + private final @Nullable String career; - public NameAndCareer(String name, String career) { + public NameAndCareer(@Nullable String name, @Nullable String career) { super(name); this.career = career; } - public String getCareer() { + public @Nullable String getCareer() { return this.career; } diff --git a/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/types/package-info.java b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/types/package-info.java new file mode 100644 index 00000000000..b734754b327 --- /dev/null +++ b/module/spring-boot-jackson/src/test/java/org/springframework/boot/jackson/types/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson.types; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/a/package-info.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/a/package-info.java new file mode 100644 index 00000000000..4284d677109 --- /dev/null +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/a/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson2.scan.a; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/b/package-info.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/b/package-info.java new file mode 100644 index 00000000000..509b32973cf --- /dev/null +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/b/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson2.scan.b; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/c/package-info.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/c/package-info.java new file mode 100644 index 00000000000..4d3a46870f9 --- /dev/null +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/c/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson2.scan.c; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/d/package-info.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/d/package-info.java new file mode 100644 index 00000000000..4b83e0d0efb --- /dev/null +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/d/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson2.scan.d; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/e/PrivateMixInClass.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/e/PrivateMixInClass.java index aaf2cab202f..7aa3f041272 100644 --- a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/e/PrivateMixInClass.java +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/e/PrivateMixInClass.java @@ -17,6 +17,7 @@ package org.springframework.boot.jackson2.scan.e; import com.fasterxml.jackson.annotation.JsonProperty; +import org.jspecify.annotations.Nullable; import org.springframework.boot.jackson2.JsonMixin; import org.springframework.boot.jackson2.types.Name; @@ -28,7 +29,7 @@ import org.springframework.boot.jackson2.types.NameAndAge; class PrivateMixInClass { @JsonProperty("username") - String getName() { + @Nullable String getName() { return null; } diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/e/package-info.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/e/package-info.java new file mode 100644 index 00000000000..1c767ffbe4a --- /dev/null +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/e/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson2.scan.e; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/f/package-info.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/f/package-info.java new file mode 100644 index 00000000000..e159e3fcaa5 --- /dev/null +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/scan/f/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson2.scan.f; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/Name.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/Name.java index 9532e2c98de..a127a7e97e7 100644 --- a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/Name.java +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/Name.java @@ -16,6 +16,8 @@ package org.springframework.boot.jackson2.types; +import org.jspecify.annotations.Nullable; + /** * Sample object used for tests. * @@ -25,13 +27,13 @@ package org.springframework.boot.jackson2.types; @Deprecated(since = "4.0.0", forRemoval = true) public class Name { - protected final String name; + protected final @Nullable String name; - public Name(String name) { + public Name(@Nullable String name) { this.name = name; } - public String getName() { + public @Nullable String getName() { return this.name; } diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndAge.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndAge.java index 85813ce0467..ba3973c09cd 100644 --- a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndAge.java +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndAge.java @@ -16,6 +16,8 @@ package org.springframework.boot.jackson2.types; +import org.jspecify.annotations.Nullable; + import org.springframework.util.ObjectUtils; /** @@ -31,7 +33,7 @@ public final class NameAndAge extends Name { private final int age; - public NameAndAge(String name, int age) { + public NameAndAge(@Nullable String name, int age) { super(name); this.age = age; } diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndCareer.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndCareer.java index 4aa9da7abbf..a5a3eb0404d 100644 --- a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndCareer.java +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/NameAndCareer.java @@ -16,6 +16,8 @@ package org.springframework.boot.jackson2.types; +import org.jspecify.annotations.Nullable; + /** * Sample object used for tests. * @@ -26,14 +28,14 @@ package org.springframework.boot.jackson2.types; @SuppressWarnings("removal") public class NameAndCareer extends Name { - private final String career; + private final @Nullable String career; - public NameAndCareer(String name, String career) { + public NameAndCareer(@Nullable String name, @Nullable String career) { super(name); this.career = career; } - public String getCareer() { + public @Nullable String getCareer() { return this.career; } diff --git a/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/package-info.java b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/package-info.java new file mode 100644 index 00000000000..384286363f6 --- /dev/null +++ b/module/spring-boot-jackson2/src/test/java/org/springframework/boot/jackson2/types/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jackson2.types; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/app/ExampleBasicObject.java b/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/app/ExampleBasicObject.java index 38c7c7469e7..e2236fbc028 100644 --- a/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/app/ExampleBasicObject.java +++ b/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/app/ExampleBasicObject.java @@ -16,6 +16,10 @@ package org.springframework.boot.jsonb.autoconfigure.jsontest.app; +import java.util.Objects; + +import org.jspecify.annotations.Nullable; + /** * Example object to read/write as JSON. * @@ -23,9 +27,9 @@ package org.springframework.boot.jsonb.autoconfigure.jsontest.app; */ public class ExampleBasicObject { - private String value; + private @Nullable String value; - public String getValue() { + public @Nullable String getValue() { return this.value; } @@ -36,14 +40,14 @@ public class ExampleBasicObject { @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { - return this.value.equals(((ExampleBasicObject) obj).value); + return Objects.equals(this.value, ((ExampleBasicObject) obj).value); } return false; } @Override public int hashCode() { - return this.value.hashCode(); + return Objects.hashCode(this.value); } } diff --git a/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/app/package-info.java b/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/app/package-info.java new file mode 100644 index 00000000000..bfc7b2c8181 --- /dev/null +++ b/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/app/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jsonb.autoconfigure.jsontest.app; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/package-info.java b/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/package-info.java new file mode 100644 index 00000000000..8ceab4cf70f --- /dev/null +++ b/module/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/jsontest/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.jsonb.autoconfigure.jsontest; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/a/package-info.java b/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/a/package-info.java new file mode 100644 index 00000000000..3e55f1359c9 --- /dev/null +++ b/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/a/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.persistence.autoconfigure.scan.a; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/b/package-info.java b/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/b/package-info.java new file mode 100644 index 00000000000..f77310b99e3 --- /dev/null +++ b/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/b/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.persistence.autoconfigure.scan.b; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/c/package-info.java b/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/c/package-info.java new file mode 100644 index 00000000000..ca7816c151e --- /dev/null +++ b/module/spring-boot-persistence/src/test/java/org/springframework/boot/persistence/autoconfigure/scan/c/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.persistence.autoconfigure.scan.c; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-security-oauth2-client/src/test/java/org/springframework/boot/security/oauth2/client/autoconfigure/servlet/webmvc/package-info.java b/module/spring-boot-security-oauth2-client/src/test/java/org/springframework/boot/security/oauth2/client/autoconfigure/servlet/webmvc/package-info.java new file mode 100644 index 00000000000..c0f4099a080 --- /dev/null +++ b/module/spring-boot-security-oauth2-client/src/test/java/org/springframework/boot/security/oauth2/client/autoconfigure/servlet/webmvc/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.security.oauth2.client.autoconfigure.servlet.webmvc; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/webmvc/package-info.java b/module/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/webmvc/package-info.java new file mode 100644 index 00000000000..fb0d756c6fd --- /dev/null +++ b/module/spring-boot-security-saml2/src/test/java/org/springframework/boot/security/saml2/autoconfigure/webmvc/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.security.saml2.autoconfigure.webmvc; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/jpa/City.java b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/jpa/City.java index 2cd042dc9e2..95303109e16 100644 --- a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/jpa/City.java +++ b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/jpa/City.java @@ -30,18 +30,23 @@ public class City implements Serializable { @Id @GeneratedValue + @SuppressWarnings("NullAway.Init") private Long id; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String name; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String state; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String country; @Column(nullable = false) + @SuppressWarnings("NullAway.Init") private String map; protected City() { diff --git a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/jpa/package-info.java b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/jpa/package-info.java new file mode 100644 index 00000000000..e5fd8acfd30 --- /dev/null +++ b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/jpa/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.security.autoconfigure.jpa; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/webfluxtest/package-info.java b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/webfluxtest/package-info.java new file mode 100644 index 00000000000..efcbe6d3825 --- /dev/null +++ b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/webfluxtest/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.thymeleaf.autoconfigure.webfluxtest; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/webmvctest/package-info.java b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/webmvctest/package-info.java new file mode 100644 index 00000000000..c5f6f21014d --- /dev/null +++ b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/webmvctest/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.thymeleaf.autoconfigure.webmvctest; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/reactive/context/config/package-info.java b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/reactive/context/config/package-info.java new file mode 100644 index 00000000000..9c43688c34e --- /dev/null +++ b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/reactive/context/config/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.web.server.reactive.context.config; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/config/package-info.java b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/config/package-info.java new file mode 100644 index 00000000000..e170d2ae1a3 --- /dev/null +++ b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/config/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.web.server.servlet.context.config; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/filter/package-info.java b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/filter/package-info.java new file mode 100644 index 00000000000..f6b556fb3c7 --- /dev/null +++ b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/filter/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.web.server.servlet.context.testcomponents.filter; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/listener/package-info.java b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/listener/package-info.java new file mode 100644 index 00000000000..4e5b3e61a42 --- /dev/null +++ b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/listener/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.web.server.servlet.context.testcomponents.listener; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/servlet/package-info.java b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/servlet/package-info.java new file mode 100644 index 00000000000..48a01fda9d6 --- /dev/null +++ b/module/spring-boot-web-server/src/test/java/org/springframework/boot/web/server/servlet/context/testcomponents/servlet/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.web.server.servlet.context.testcomponents.servlet; + +import org.jspecify.annotations.NullMarked; diff --git a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/ExampleWebMvcConfigurer.java b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/ExampleWebMvcConfigurer.java index 64a0ff7c345..ac566cd124f 100644 --- a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/ExampleWebMvcConfigurer.java +++ b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/ExampleWebMvcConfigurer.java @@ -18,6 +18,8 @@ package org.springframework.boot.webmvc.test.autoconfigure.mockmvc; import java.util.List; +import org.jspecify.annotations.Nullable; + import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest; import org.springframework.core.MethodParameter; import org.springframework.stereotype.Component; @@ -45,8 +47,8 @@ public class ExampleWebMvcConfigurer implements WebMvcConfigurer { } @Override - public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, - NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { + public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { return new ExampleArgument("hello"); } diff --git a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverCustomScopeIntegrationTests.java b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverCustomScopeIntegrationTests.java index 8343f2ee570..c855beb54be 100644 --- a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverCustomScopeIntegrationTests.java +++ b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverCustomScopeIntegrationTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.webmvc.test.autoconfigure.mockmvc; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; @@ -44,8 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; class WebMvcTestHtmlUnitWebDriverCustomScopeIntegrationTests { // gh-7454 - - private static WebDriver previousWebDriver; + private static @Nullable WebDriver previousWebDriver; @Autowired private WebDriver webDriver; diff --git a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverIntegrationTests.java b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverIntegrationTests.java index d283d8f20b5..73f9b822724 100644 --- a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverIntegrationTests.java +++ b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/WebMvcTestHtmlUnitWebDriverIntegrationTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.webmvc.test.autoconfigure.mockmvc; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; @@ -42,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @AutoConfigureMockMvc(htmlUnit = @HtmlUnit(url = "http://localhost:8181")) class WebMvcTestHtmlUnitWebDriverIntegrationTests { - private static WebDriver previousWebDriver; + private static @Nullable WebDriver previousWebDriver; @Autowired private WebDriver webDriver; @@ -60,8 +61,8 @@ class WebMvcTestHtmlUnitWebDriverIntegrationTests { this.webDriver.get("/html"); WebElement element = this.webDriver.findElement(By.tagName("body")); assertThat(element.getText()).isEqualTo("Hello"); - assertThatExceptionOfType(NoSuchSessionException.class).isThrownBy(previousWebDriver::getWindowHandle); assertThat(previousWebDriver).isNotNull().isNotSameAs(this.webDriver); + assertThatExceptionOfType(NoSuchSessionException.class).isThrownBy(previousWebDriver::getWindowHandle); assertThat(this.webDriver.getCurrentUrl()).isEqualTo("http://localhost:8181/html"); } diff --git a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/package-info.java b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/package-info.java new file mode 100644 index 00000000000..3aca2409e1f --- /dev/null +++ b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/mockmvc/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.webmvc.test.autoconfigure.mockmvc; + +import org.jspecify.annotations.NullMarked; diff --git a/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/SampleIntegrationApplicationTests.java b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/SampleIntegrationApplicationTests.java index f2fdb894b7b..f09d703b13e 100644 --- a/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/SampleIntegrationApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/SampleIntegrationApplicationTests.java @@ -23,6 +23,7 @@ import java.nio.file.Path; import java.time.Duration; import org.awaitility.Awaitility; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -52,7 +53,7 @@ import static org.hamcrest.Matchers.containsString; @ExtendWith(OutputCaptureExtension.class) class SampleIntegrationApplicationTests { - private ConfigurableApplicationContext context; + private @Nullable ConfigurableApplicationContext context; @AfterEach void stopAndCheck(CapturedOutput output) { @@ -82,12 +83,13 @@ class SampleIntegrationApplicationTests { awaitOutputContaining(this.context.getBean(ServiceProperties.class).getOutputDir(), "testviamg"); } - private void awaitOutputContaining(File outputDir, String requiredContents) { + private void awaitOutputContaining(@Nullable File outputDir, String requiredContents) { + assertThat(outputDir).isNotNull(); Awaitility.waitAtMost(Duration.ofSeconds(30)) .until(() -> outputIn(outputDir), containsString(requiredContents)); } - private String outputIn(File outputDir) throws IOException { + private @Nullable String outputIn(File outputDir) throws IOException { Resource[] resources = findResources(outputDir); if (resources.length == 0) { return null; diff --git a/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/package-info.java b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/package-info.java new file mode 100644 index 00000000000..2607e21bc48 --- /dev/null +++ b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package smoketest.integration.consumer; + +import org.jspecify.annotations.NullMarked; diff --git a/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/producer/ProducerApplication.java b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/producer/ProducerApplication.java index 280d85f4dab..d54da02b727 100644 --- a/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/producer/ProducerApplication.java +++ b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/producer/ProducerApplication.java @@ -19,6 +19,7 @@ package smoketest.integration.producer; import java.io.File; import java.io.FileOutputStream; +import org.jspecify.annotations.Nullable; import smoketest.integration.ServiceProperties; import org.springframework.boot.ApplicationArguments; @@ -26,6 +27,7 @@ import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; +import org.springframework.util.Assert; @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(ServiceProperties.class) @@ -39,10 +41,12 @@ public class ProducerApplication implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { - this.serviceProperties.getInputDir().mkdirs(); + @Nullable File inputDir = this.serviceProperties.getInputDir(); + Assert.notNull(inputDir, "No inputDir configured"); + inputDir.mkdirs(); if (!args.getNonOptionArgs().isEmpty()) { FileOutputStream stream = new FileOutputStream( - new File(this.serviceProperties.getInputDir(), "data" + System.currentTimeMillis() + ".txt")); + new File(inputDir, "data" + System.currentTimeMillis() + ".txt")); for (String arg : args.getNonOptionArgs()) { stream.write(arg.getBytes()); } diff --git a/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/producer/package-info.java b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/producer/package-info.java new file mode 100644 index 00000000000..38ae0d4a8b7 --- /dev/null +++ b/smoke-test/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/producer/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package smoketest.integration.producer; + +import org.jspecify.annotations.NullMarked; diff --git a/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java index b81b072f80e..043a31bff1e 100644 --- a/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java @@ -23,6 +23,7 @@ import java.nio.file.Path; import java.time.Duration; import org.awaitility.Awaitility; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import smoketest.parent.SampleParentContextApplication; @@ -63,7 +64,7 @@ class SampleIntegrationParentApplicationTests { .until(() -> outputIn(outputDir), containsString(requiredContents)); } - private String outputIn(File outputDir) throws IOException { + private @Nullable String outputIn(File outputDir) throws IOException { Resource[] resources = findResources(outputDir); if (resources.length == 0) { return null; diff --git a/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/package-info.java b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/package-info.java new file mode 100644 index 00000000000..c57071d99fe --- /dev/null +++ b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package smoketest.parent.consumer; + +import org.jspecify.annotations.NullMarked; diff --git a/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/producer/ProducerApplication.java b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/producer/ProducerApplication.java index 06641142253..03e2149ea84 100644 --- a/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/producer/ProducerApplication.java +++ b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/producer/ProducerApplication.java @@ -19,6 +19,7 @@ package smoketest.parent.producer; import java.io.File; import java.io.FileOutputStream; +import org.jspecify.annotations.Nullable; import smoketest.parent.ServiceProperties; import org.springframework.boot.ApplicationArguments; @@ -26,6 +27,7 @@ import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; +import org.springframework.util.Assert; @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(ServiceProperties.class) @@ -39,10 +41,12 @@ public class ProducerApplication implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { - this.serviceProperties.getInputDir().mkdirs(); + @Nullable File inputDir = this.serviceProperties.getInputDir(); + Assert.notNull(inputDir, "No inputDir configured"); + inputDir.mkdirs(); if (!args.getNonOptionArgs().isEmpty()) { FileOutputStream stream = new FileOutputStream( - new File(this.serviceProperties.getInputDir(), "data" + System.currentTimeMillis() + ".txt")); + new File(inputDir, "data" + System.currentTimeMillis() + ".txt")); for (String arg : args.getNonOptionArgs()) { stream.write(arg.getBytes()); } diff --git a/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/producer/package-info.java b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/producer/package-info.java new file mode 100644 index 00000000000..047edc9464c --- /dev/null +++ b/smoke-test/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/producer/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package smoketest.parent.producer; + +import org.jspecify.annotations.NullMarked; diff --git a/smoke-test/spring-boot-smoke-test-webflux-coroutines/build.gradle b/smoke-test/spring-boot-smoke-test-webflux-coroutines/build.gradle index 7058a3f917f..71e8e3169bb 100644 --- a/smoke-test/spring-boot-smoke-test-webflux-coroutines/build.gradle +++ b/smoke-test/spring-boot-smoke-test-webflux-coroutines/build.gradle @@ -31,8 +31,6 @@ dependencies { testImplementation(project(":starter:spring-boot-starter-webflux-test")) } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } diff --git a/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java index 2beb3dd3780..f16cbdb4a5e 100644 --- a/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java +++ b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java @@ -26,6 +26,7 @@ import org.apache.hc.client5.http.impl.classic.HttpClients; import org.apache.hc.core5.util.TimeValue; import org.awaitility.Awaitility; import org.awaitility.core.ConditionTimeoutException; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import org.testcontainers.containers.GenericContainer; import org.testcontainers.images.builder.ImageFromDockerfile; @@ -128,7 +129,7 @@ abstract class AbstractDeploymentTests { } WarDeploymentContainer(String baseImage, String deploymentLocation, int port, - Consumer dockerfileCustomizer) { + @Nullable Consumer dockerfileCustomizer) { super(new ImageFromDockerfile().withFileFromFile("spring-boot.war", findWarToDeploy()) .withDockerfileFromBuilder((builder) -> { builder.from(baseImage).add("spring-boot.war", deploymentLocation + "/spring-boot.war"); diff --git a/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/package-info.java b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/package-info.java new file mode 100644 index 00000000000..aec6983401c --- /dev/null +++ b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.deployment; + +import org.jspecify.annotations.NullMarked; diff --git a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java index dbf5dcea437..70e8357bf5e 100644 --- a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java +++ b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java @@ -30,6 +30,7 @@ import org.assertj.core.api.AbstractMapAssert; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.ListAssert; import org.assertj.core.api.ObjectAssert; +import org.jspecify.annotations.Nullable; import org.springframework.boot.test.json.JsonContentAssert; @@ -80,7 +81,7 @@ public class ContainerConfigAssert extends AbstractAssert, String, String> { - protected LabelsAssert(Map labels) { + protected LabelsAssert(@Nullable Map labels) { super(labels, LabelsAssert.class); } diff --git a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/package-info.java b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/package-info.java new file mode 100644 index 00000000000..5aebf620b37 --- /dev/null +++ b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.image.assertions; + +import org.jspecify.annotations.NullMarked; diff --git a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/junit/GradleBuildInjectionExtension.java b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/junit/GradleBuildInjectionExtension.java index 78f83f1337c..9950cb3d00c 100644 --- a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/junit/GradleBuildInjectionExtension.java +++ b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/junit/GradleBuildInjectionExtension.java @@ -49,6 +49,7 @@ public class GradleBuildInjectionExtension implements BeforeEachCallback { .gradleVersion(GradleVersions.minimumCompatible()) .bootVersion(this.bootVersion); Field field = ReflectionUtils.findField(context.getRequiredTestClass(), "gradleBuild"); + Assert.notNull(field, "No gradleBuild field found in " + context.getRequiredTestClass().getName()); field.setAccessible(true); field.set(context.getRequiredTestInstance(), gradleBuild); } diff --git a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/junit/package-info.java b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/junit/package-info.java new file mode 100644 index 00000000000..f1deddb1254 --- /dev/null +++ b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/junit/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.image.junit; + +import org.jspecify.annotations.NullMarked; diff --git a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java index 58114634865..d2e7d5259ed 100644 --- a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java +++ b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java @@ -31,7 +31,9 @@ import java.util.jar.JarFile; import com.github.dockerjava.api.model.ContainerConfig; import org.assertj.core.api.Condition; import org.gradle.testkit.runner.BuildResult; +import org.gradle.testkit.runner.BuildTask; import org.gradle.testkit.runner.TaskOutcome; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -62,6 +64,7 @@ import static org.assertj.core.api.Assertions.entry; @ExtendWith({ GradleBuildInjectionExtension.class, GradleBuildExtension.class }) class PaketoBuilderTests { + @SuppressWarnings("NullAway.Init") GradleBuild gradleBuild; @BeforeEach @@ -81,7 +84,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName(); ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -113,7 +116,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName(); ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withCommand("--server.port=9090"); @@ -131,7 +134,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName(); ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -140,7 +143,7 @@ class PaketoBuilderTests { } this.gradleBuild.expectDeprecationMessages("BOM table is deprecated"); result = buildImage(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); container.waitingFor(Wait.forHttp("/test")).start(); @@ -158,7 +161,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + projectName; ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName, "assemble", "bootDistZip"); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -195,7 +198,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + projectName; ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName, "assemble", "bootDistZip"); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -233,7 +236,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName(); ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -266,7 +269,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName(); ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImageWithRetry(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -316,7 +319,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName(); ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -346,7 +349,7 @@ class PaketoBuilderTests { String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName(); ImageReference imageReference = ImageReference.of(ImageName.of(imageName)); BuildResult result = buildImage(imageName); - assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + assertThat(result.task(":bootBuildImage")).extracting(BuildTask::getOutcome).isEqualTo(TaskOutcome.SUCCESS); assertThat(result.getOutput()).contains("Running creator"); try (GenericContainer container = new GenericContainer<>(imageName)) { container.withExposedPorts(8080); @@ -569,7 +572,7 @@ class PaketoBuilderTests { private static class DigestCapturingCondition extends Condition { - private static String digest; + private static @Nullable String digest; DigestCapturingCondition() { super(predicate(), "a value starting with 'sha256:'"); @@ -583,6 +586,7 @@ class PaketoBuilderTests { } String getDigest() { + assertThat(digest).isNotNull(); return digest; } @@ -590,14 +594,15 @@ class PaketoBuilderTests { private static class DigestsCapturingCondition extends Condition { - private static List digests; + private static @Nullable List digests; DigestsCapturingCondition() { super(predicate(), "a value starting with 'sha256:'"); } private static Predicate predicate() { - digests = new ArrayList<>(); + List digests = new ArrayList<>(); + DigestsCapturingCondition.digests = digests; return (sha) -> { digests.add(sha.toString()); return sha.toString().startsWith("sha256:"); @@ -605,6 +610,7 @@ class PaketoBuilderTests { } String getDigest(int index) { + assertThat(digests).isNotNull(); return digests.get(index); } diff --git a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/paketo/package-info.java b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/paketo/package-info.java new file mode 100644 index 00000000000..38ed0e0e474 --- /dev/null +++ b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/paketo/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@NullMarked +package org.springframework.boot.image.paketo; + +import org.jspecify.annotations.NullMarked; diff --git a/test-support/spring-boot-docker-test-support/build.gradle b/test-support/spring-boot-docker-test-support/build.gradle index 74ed8f66f58..569f5e9c826 100644 --- a/test-support/spring-boot-docker-test-support/build.gradle +++ b/test-support/spring-boot-docker-test-support/build.gradle @@ -51,8 +51,6 @@ dependencies { optional("com.redis:testcontainers-redis") } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } diff --git a/test-support/spring-boot-gradle-test-support/build.gradle b/test-support/spring-boot-gradle-test-support/build.gradle index 33a281ea384..fd77bd84e76 100644 --- a/test-support/spring-boot-gradle-test-support/build.gradle +++ b/test-support/spring-boot-gradle-test-support/build.gradle @@ -31,8 +31,6 @@ dependencies { implementation("org.springframework:spring-core") } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false } diff --git a/test-support/spring-boot-test-support/build.gradle b/test-support/spring-boot-test-support/build.gradle index 40b7cd6562a..2534c7ef1c4 100644 --- a/test-support/spring-boot-test-support/build.gradle +++ b/test-support/spring-boot-test-support/build.gradle @@ -62,8 +62,6 @@ dependencies { testRuntimeOnly("org.hibernate.validator:hibernate-validator") } -architectureCheck { - nullMarked { - enabled = false - } +nullability { + requireExplicitNullMarking = false }