Fix overridden methods nullability

Issue: SPR-15869
This commit is contained in:
Sebastien Deleuze
2017-08-17 14:30:14 +02:00
parent 6b6c1d3e53
commit 73cf07e9a4
488 changed files with 1016 additions and 34 deletions

View File

@@ -266,6 +266,7 @@ public class MockServletContext implements ServletContext {
}
@Override
@Nullable
public String getMimeType(String filePath) {
String extension = StringUtils.getFilenameExtension(filePath);
if (this.mimeTypes.containsKey(extension)) {

View File

@@ -118,6 +118,7 @@ public class DefaultContextCache implements ContextCache {
* {@inheritDoc}
*/
@Override
@Nullable
public ApplicationContext get(MergedContextConfiguration key) {
Assert.notNull(key, "Key must not be null");
ApplicationContext context = this.contextMap.get(key);

View File

@@ -147,6 +147,7 @@ public class DefaultTestContext implements TestContext {
return testMethod;
}
@Override
@Nullable
public final Throwable getTestException() {
return this.testException;
@@ -172,12 +173,14 @@ public class DefaultTestContext implements TestContext {
}
@Override
@Nullable
public Object getAttribute(String name) {
Assert.notNull(name, "Name must not be null");
return this.attributes.get(name);
}
@Override
@Nullable
public Object removeAttribute(String name) {
Assert.notNull(name, "Name must not be null");
return this.attributes.remove(name);

View File

@@ -251,6 +251,7 @@ public abstract class TestContextTransactionUtils {
}
@Override
@Nullable
public String getName() {
return this.name;
}

View File

@@ -20,6 +20,7 @@ import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ContextConfigurationAttributes;
import org.springframework.test.context.ContextCustomizer;
import org.springframework.test.context.ContextCustomizerFactory;
@@ -46,6 +47,7 @@ class MockServerContainerContextCustomizerFactory implements ContextCustomizerFa
@Override
@Nullable
public ContextCustomizer createContextCustomizer(Class<?> testClass,
List<ContextConfigurationAttributes> configAttributes) {

View File

@@ -21,6 +21,8 @@ import java.time.Duration;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.lang.Nullable;
/**
* {@code ExchangeResult} variant with the response body decoded as
* {@code Flux<T>} but not yet consumed.
@@ -87,6 +89,7 @@ public class FluxExchangeResult<T> extends ExchangeResult {
* via {@code getResponseBody.ignoreElements()}.
*/
@Override
@Nullable
public byte[] getResponseBodyContent() {
return this.body.ignoreElements()
.timeout(this.timeout, Mono.error(TIMEOUT_ERROR))

View File

@@ -16,6 +16,7 @@
package org.springframework.test.web.servlet.setup;
import org.springframework.lang.Nullable;
import org.springframework.test.web.servlet.request.RequestPostProcessor;
import org.springframework.web.context.WebApplicationContext;
@@ -32,6 +33,7 @@ public abstract class MockMvcConfigurerAdapter implements MockMvcConfigurer {
}
@Override
@Nullable
public RequestPostProcessor beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext cxt) {
return null;
}

View File

@@ -539,6 +539,7 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
}
@Override
@Nullable
public View resolveViewName(String viewName, Locale locale) throws Exception {
return this.view;
}

View File

@@ -275,6 +275,7 @@ class StubWebApplicationContext implements WebApplicationContext {
}
@Override
@Nullable
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
throws NoSuchBeanDefinitionException{
@@ -322,6 +323,7 @@ class StubWebApplicationContext implements WebApplicationContext {
//---------------------------------------------------------------------
@Override
@Nullable
public ClassLoader getClassLoader() {
return ClassUtils.getDefaultClassLoader();
}
@@ -399,11 +401,13 @@ class StubWebApplicationContext implements WebApplicationContext {
}
@Override
@Nullable
public Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName) {
throw new UnsupportedOperationException("Dependency resolution not supported");
}
@Override
@Nullable
public Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName,
@Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) {
throw new UnsupportedOperationException("Dependency resolution not supported");