Nullability refinements and related polishing

This commit is contained in:
Juergen Hoeller
2020-10-13 00:08:15 +02:00
parent 1b63c31722
commit 7f365942a5
7 changed files with 37 additions and 15 deletions

View File

@@ -27,6 +27,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ContextConfigurationAttributes;
import org.springframework.test.context.ContextHierarchy;
@@ -249,11 +250,11 @@ abstract class ContextLoaderUtils {
}
private static void resolveContextConfigurationAttributes(List<ContextConfigurationAttributes> attributesList,
AnnotationDescriptor<ContextConfiguration> descriptor) {
@Nullable AnnotationDescriptor<ContextConfiguration> descriptor) {
if (descriptor != null) {
convertContextConfigToConfigAttributesAndAddToList(descriptor.synthesizeAnnotation(),
descriptor.getRootDeclaringClass(), attributesList);
descriptor.getRootDeclaringClass(), attributesList);
resolveContextConfigurationAttributes(attributesList, descriptor.next());
}
}

View File

@@ -163,6 +163,7 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
return findTransactionAttributeInEnclosingClassHierarchy(clazz);
}
@Nullable
private TransactionAttribute findTransactionAttributeInEnclosingClassHierarchy(Class<?> clazz) {
if (MetaAnnotationUtils.searchEnclosingClass(clazz)) {
return findTransactionAttribute(clazz.getEnclosingClass());

View File

@@ -16,6 +16,7 @@
package org.springframework.test.context.web;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ContextLoader;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.TestContextBootstrapper;
@@ -70,6 +71,7 @@ public class WebTestContextBootstrapper extends DefaultTestContextBootstrapper {
}
}
@Nullable
private static WebAppConfiguration getWebAppConfiguration(Class<?> testClass) {
return MetaAnnotationUtils.findMergedAnnotation(testClass, WebAppConfiguration.class);
}