Specify generic type nullness in spring-core

Also in spring-core-test.

See gh-34140
This commit is contained in:
Sébastien Deleuze
2025-01-13 20:52:00 +01:00
parent 435cb0c7d6
commit 9d9383aaeb
31 changed files with 160 additions and 134 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2025 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.
@@ -29,6 +29,7 @@ import java.util.Objects;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Test;
@@ -469,13 +470,13 @@ class AnnotationsScannerTests {
new AnnotationsProcessor<Object, String>() {
@Override
public String doWithAggregate(Object context, int aggregateIndex) {
public @NonNull String doWithAggregate(Object context, int aggregateIndex) {
return "";
}
@Override
public String doWithAnnotations(Object context, int aggregateIndex,
@Nullable Object source, Annotation[] annotations) {
public @NonNull String doWithAnnotations(Object context, int aggregateIndex,
@Nullable Object source, @Nullable Annotation @Nullable [] annotations) {
throw new IllegalStateException("Should not call");
}
@@ -501,13 +502,13 @@ class AnnotationsScannerTests {
new AnnotationsProcessor<Object, String>() {
@Override
public String doWithAnnotations(Object context, int aggregateIndex,
@Nullable Object source, Annotation[] annotations) {
public @NonNull String doWithAnnotations(Object context, int aggregateIndex,
@Nullable Object source, @Nullable Annotation @Nullable [] annotations) {
return "K";
}
@Override
public String finish(@Nullable String result) {
public @NonNull String finish(@Nullable String result) {
return "O" + result;
}