Make classes final where possible
Update classes that have private constructors so that they are also declared final. In a few cases, inner-classes used private constructors but were subclassed. These have now been changed to have package-private constructors. Issue gh-8945
This commit is contained in:
@@ -294,7 +294,7 @@ public class FilterChainProxy extends GenericFilterBean {
|
||||
* Internal {@code FilterChain} implementation that is used to pass a request through
|
||||
* the additional internal list of filters which match the request.
|
||||
*/
|
||||
private static class VirtualFilterChain implements FilterChain {
|
||||
private static final class VirtualFilterChain implements FilterChain {
|
||||
|
||||
private final FilterChain originalChain;
|
||||
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
* @author Mathieu Ouellet
|
||||
* @since 5.0
|
||||
*/
|
||||
public class DelegatingReactiveAuthorizationManager implements ReactiveAuthorizationManager<ServerWebExchange> {
|
||||
public final class DelegatingReactiveAuthorizationManager implements ReactiveAuthorizationManager<ServerWebExchange> {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DelegatingReactiveAuthorizationManager.class);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DelegatingReactiveAuthorizationManager implements ReactiveAuthoriza
|
||||
return new DelegatingReactiveAuthorizationManager.Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public static final class Builder {
|
||||
|
||||
private final List<ServerWebExchangeMatcherEntry<ReactiveAuthorizationManager<AuthorizationContext>>> mappings = new ArrayList<>();
|
||||
|
||||
|
||||
+4
-5
@@ -28,13 +28,15 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class NoOpServerSecurityContextRepository implements ServerSecurityContextRepository {
|
||||
public final class NoOpServerSecurityContextRepository implements ServerSecurityContextRepository {
|
||||
|
||||
private static final NoOpServerSecurityContextRepository INSTANCE = new NoOpServerSecurityContextRepository();
|
||||
|
||||
private NoOpServerSecurityContextRepository() {
|
||||
}
|
||||
|
||||
public Mono<Void> save(ServerWebExchange exchange, SecurityContext context) {
|
||||
return Mono.empty();
|
||||
|
||||
}
|
||||
|
||||
public Mono<SecurityContext> load(ServerWebExchange exchange) {
|
||||
@@ -45,7 +47,4 @@ public class NoOpServerSecurityContextRepository implements ServerSecurityContex
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private NoOpServerSecurityContextRepository() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -30,7 +30,10 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class NoOpServerRequestCache implements ServerRequestCache {
|
||||
public final class NoOpServerRequestCache implements ServerRequestCache {
|
||||
|
||||
private NoOpServerRequestCache() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> saveRequest(ServerWebExchange exchange) {
|
||||
@@ -51,7 +54,4 @@ public class NoOpServerRequestCache implements ServerRequestCache {
|
||||
return new NoOpServerRequestCache();
|
||||
}
|
||||
|
||||
private NoOpServerRequestCache() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -263,7 +263,7 @@ public final class AntPathRequestMatcher implements RequestMatcher, RequestVaria
|
||||
|
||||
}
|
||||
|
||||
private static class SpringAntMatcher implements Matcher {
|
||||
private static final class SpringAntMatcher implements Matcher {
|
||||
|
||||
private final AntPathMatcher antMatcher;
|
||||
|
||||
@@ -296,7 +296,7 @@ public final class AntPathRequestMatcher implements RequestMatcher, RequestVaria
|
||||
/**
|
||||
* Optimized matcher for trailing wildcards
|
||||
*/
|
||||
private static class SubpathMatcher implements Matcher {
|
||||
private static final class SubpathMatcher implements Matcher {
|
||||
|
||||
private final String subpath;
|
||||
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ import org.springframework.web.server.handler.FilteringWebHandler;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class WebTestHandler {
|
||||
public final class WebTestHandler {
|
||||
|
||||
private final MockWebHandler webHandler = new MockWebHandler();
|
||||
|
||||
@@ -50,7 +50,7 @@ public class WebTestHandler {
|
||||
return new WebHandlerResult(webHandler.exchange);
|
||||
}
|
||||
|
||||
public static class WebHandlerResult {
|
||||
public static final class WebHandlerResult {
|
||||
|
||||
private final ServerWebExchange exchange;
|
||||
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ public class PersistentTokenBasedRememberMeServicesTests {
|
||||
return services;
|
||||
}
|
||||
|
||||
private class MockTokenRepository implements PersistentTokenRepository {
|
||||
private final class MockTokenRepository implements PersistentTokenRepository {
|
||||
|
||||
private PersistentRememberMeToken storedToken;
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ import static java.util.stream.Collectors.joining;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ResolvableMethod {
|
||||
public final class ResolvableMethod {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ResolvableMethod.class);
|
||||
|
||||
@@ -253,7 +253,7 @@ public class ResolvableMethod {
|
||||
/**
|
||||
* Builder for {@code ResolvableMethod}.
|
||||
*/
|
||||
public static class Builder<T> {
|
||||
public static final class Builder<T> {
|
||||
|
||||
private final Class<?> objectClass;
|
||||
|
||||
@@ -386,7 +386,7 @@ public class ResolvableMethod {
|
||||
* <p>
|
||||
* {@code build().method()}
|
||||
*/
|
||||
public final Method resolveMethod() {
|
||||
public Method resolveMethod() {
|
||||
return build().method();
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ public class ResolvableMethod {
|
||||
* <p>
|
||||
* {@code build().returnType()}
|
||||
*/
|
||||
public final MethodParameter resolveReturnType() {
|
||||
public MethodParameter resolveReturnType() {
|
||||
return build().returnType();
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ public class ResolvableMethod {
|
||||
/**
|
||||
* Predicate with a descriptive label.
|
||||
*/
|
||||
private static class LabeledPredicate<T> implements Predicate<T> {
|
||||
private static final class LabeledPredicate<T> implements Predicate<T> {
|
||||
|
||||
private final String label;
|
||||
|
||||
@@ -493,7 +493,7 @@ public class ResolvableMethod {
|
||||
/**
|
||||
* Resolver for method arguments.
|
||||
*/
|
||||
public class ArgResolver {
|
||||
public final class ArgResolver {
|
||||
|
||||
private final List<Predicate<MethodParameter>> filters = new ArrayList<>(4);
|
||||
|
||||
@@ -564,7 +564,7 @@ public class ResolvableMethod {
|
||||
/**
|
||||
* Resolve the argument.
|
||||
*/
|
||||
public final MethodParameter arg() {
|
||||
public MethodParameter arg() {
|
||||
List<MethodParameter> matches = applyFilters();
|
||||
Assert.state(!matches.isEmpty(), () -> "No matching arg in method\n" + formatMethod());
|
||||
Assert.state(matches.size() == 1,
|
||||
|
||||
Reference in New Issue
Block a user