mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Upgrade to Nullability Plugin 0.0.9
Closes gh-48638
This commit is contained in:
+1
@@ -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
|
||||
|
||||
+1
@@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ExtendWith(GradleMultiDslExtension.class)
|
||||
class IntegratingWithActuatorDocumentationTests {
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
GradleBuild gradleBuild;
|
||||
|
||||
@TestTemplate
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assumptions.assumingThat;
|
||||
@ExtendWith(GradleMultiDslExtension.class)
|
||||
class ManagingDependenciesDocumentationTests {
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
GradleBuild gradleBuild;
|
||||
|
||||
@TestTemplate
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ExtendWith(GradleMultiDslExtension.class)
|
||||
class PackagingDocumentationTests {
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
GradleBuild gradleBuild;
|
||||
|
||||
@TestTemplate
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ExtendWith(GradleMultiDslExtension.class)
|
||||
class PublishingDocumentationTests {
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
GradleBuild gradleBuild;
|
||||
|
||||
@TestTemplate
|
||||
|
||||
+1
@@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ExtendWith(GradleMultiDslExtension.class)
|
||||
class RunningDocumentationTests {
|
||||
|
||||
@SuppressWarnings("NullAway.Init")
|
||||
GradleBuild gradleBuild;
|
||||
|
||||
@TestTemplate
|
||||
|
||||
+20
@@ -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;
|
||||
+2
@@ -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);
|
||||
|
||||
|
||||
+3
-2
@@ -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() {
|
||||
}
|
||||
|
||||
+20
@@ -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;
|
||||
+20
@@ -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;
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
+20
@@ -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;
|
||||
+23
@@ -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;
|
||||
Reference in New Issue
Block a user