Perform NullAway build-time checks in more modules

This commit enables null-safety build-time checks in
all remaining modules except spring-test.

See gh-32475
This commit is contained in:
Sébastien Deleuze
2024-03-26 15:53:01 +01:00
parent 2fea3d7921
commit 8b51b36729
53 changed files with 93 additions and 31 deletions

View File

@@ -63,6 +63,7 @@ public class BindingReflectionHintsRegistrar {
* @param hints the hints instance to use
* @param types the types to register
*/
@SuppressWarnings("NullAway")
public void registerReflectionHints(ReflectionHints hints, @Nullable Type... types) {
Set<Type> seen = new HashSet<>();
for (Type type : types) {

View File

@@ -108,7 +108,7 @@ public abstract class CoroutinesUtils {
* @throws IllegalArgumentException if {@code method} is not a suspending function
* @since 6.0
*/
@SuppressWarnings({"deprecation", "DataFlowIssue"})
@SuppressWarnings({"deprecation", "DataFlowIssue", "NullAway"})
public static Publisher<?> invokeSuspendingFunction(
CoroutineContext context, Method method, @Nullable Object target, @Nullable Object... args) {

View File

@@ -322,6 +322,7 @@ final class PlaceholderParser {
}
@Override
@Nullable
public String resolvePlaceholder(String placeholderName) {
String value = this.resolver.resolvePlaceholder(placeholderName);
if (value != null && logger.isTraceEnabled()) {
@@ -358,6 +359,7 @@ final class PlaceholderParser {
}
public void removePlaceholder(String placeholder) {
Assert.state(this.visitedPlaceholders != null, "Visited placeholders must not be null");
this.visitedPlaceholders.remove(placeholder);
}

View File

@@ -25,6 +25,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.Charset;
import org.springframework.lang.Contract;
import org.springframework.lang.Nullable;
/**
@@ -201,6 +202,7 @@ public abstract class StreamUtils {
* @throws IOException in case of I/O errors
* @since 4.3
*/
@Contract("null -> fail")
public static int drain(@Nullable InputStream in) throws IOException {
Assert.notNull(in, "No InputStream specified");
return (int) in.transferTo(OutputStream.nullOutputStream());