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:
@@ -111,7 +111,7 @@ public final class MappedInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
/**
|
||||
* The configured PathMatcher, or {@code null}.
|
||||
* The configured PathMatcher, or {@code null} if none.
|
||||
*/
|
||||
@Nullable
|
||||
public PathMatcher getPathMatcher() {
|
||||
@@ -121,6 +121,7 @@ public final class MappedInterceptor implements HandlerInterceptor {
|
||||
/**
|
||||
* The path into the application the interceptor is mapped to.
|
||||
*/
|
||||
@Nullable
|
||||
public String[] getPathPatterns() {
|
||||
return this.includePatterns;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,6 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
* Return the generic type of the {@code returnType} (or of the nested type
|
||||
* if it is an {@link HttpEntity}).
|
||||
*/
|
||||
@Nullable
|
||||
private Type getGenericType(MethodParameter returnType) {
|
||||
if (HttpEntity.class.isAssignableFrom(returnType.getParameterType())) {
|
||||
return ResolvableType.forType(returnType.getGenericParameterType()).getGeneric().getType();
|
||||
|
||||
@@ -519,11 +519,12 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
private View applyLifecycleMethods(String viewName, AbstractView view) {
|
||||
ApplicationContext context = getApplicationContext();
|
||||
if (context != null) {
|
||||
return (View) context.getAutowireCapableBeanFactory().initializeBean(view, viewName);
|
||||
}
|
||||
else {
|
||||
return view;
|
||||
Object initialized = context.getAutowireCapableBeanFactory().initializeBean(view, viewName);
|
||||
if (initialized instanceof View) {
|
||||
return (View) initialized;
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user