Consistent use of @Nullable in spring-test

This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
This commit is contained in:
Juergen Hoeller
2017-06-08 22:52:57 +02:00
parent ee5fa2633a
commit fd53d2a51a
134 changed files with 812 additions and 777 deletions

View File

@@ -56,6 +56,7 @@ import org.springframework.util.MultiValueMap;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.any;
import static org.mockito.BDDMockito.*;
/**
@@ -86,7 +87,7 @@ public class ResolvableTypeTests {
assertThat(none.getGenerics().length, equalTo(0));
assertThat(none.getInterfaces().length, equalTo(0));
assertThat(none.getSuperType(), equalTo(ResolvableType.NONE));
assertThat(none.getType(), nullValue());
assertThat(none.getType(), equalTo(ResolvableType.EmptyType.INSTANCE));
assertThat(none.hasGenerics(), equalTo(false));
assertThat(none.isArray(), equalTo(false));
assertThat(none.resolve(), nullValue());