DATACMNS-1114 - Introduced usage of nullable annotations for API validation.
Marked all packages with Spring Frameworks @NonNullApi. Added Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fixed Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances. Removed null handling from converters for JodaTime and ThreeTenBP. Introduced factory methods Page.empty() and Page.empty(Pageable). Introduced default methods getRequiredGetter(), …Setter() and …Field() on PersistentProperty to allow non-nullable lookups of members. The same for TypeInformation.getrequiredActualType(), …SuperTypeInformation(). Tweaked PersistentPropertyCreator.addPropertiesForRemainingDescriptors() to filter unsuitable PropertyDescriptors before actually trying to create a Property instance from them as the new stronger nullability requirements would cause exceptions downstream. Lazy.get() now expects a non-null return value. Clients being able to cope with null need to call ….orElse(…). Original pull request: #232.
This commit is contained in:
@@ -39,11 +39,13 @@ public class ProxyProjectionFactoryUnitTests {
|
||||
|
||||
ProjectionFactory factory = new ProxyProjectionFactory();
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-630
|
||||
public void rejectsNullProjectionType() {
|
||||
factory.createProjection(null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test(expected = IllegalArgumentException.class) // DATACMNS-630
|
||||
public void rejectsNullProjectionTypeWithSource() {
|
||||
factory.createProjection(null, new Object());
|
||||
@@ -51,7 +53,7 @@ public class ProxyProjectionFactoryUnitTests {
|
||||
|
||||
@Test // DATACMNS-630
|
||||
public void returnsNullForNullSource() {
|
||||
assertThat(factory.createProjection(CustomerExcerpt.class, null)).isNull();
|
||||
assertThat(factory.createNullableProjection(CustomerExcerpt.class, null)).isNull();
|
||||
}
|
||||
|
||||
@Test // DATAREST-221, DATACMNS-630
|
||||
|
||||
Reference in New Issue
Block a user