Use consistent class design
Update all classes so that inner classes are always last. Also ensure that utility classes are always final and have a private constructor and make exceptions final whenever possible. Issue: SPR-16968
This commit is contained in:
committed by
Juergen Hoeller
parent
0ad0f341bd
commit
eeebd51f57
@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ReactiveTypeDescriptor {
|
||||
public final class ReactiveTypeDescriptor {
|
||||
|
||||
private final Class<?> reactiveType;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,12 @@ import org.springframework.lang.Nullable;
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.1
|
||||
*/
|
||||
public class SpringVersion {
|
||||
public final class SpringVersion {
|
||||
|
||||
|
||||
private SpringVersion() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the full version string of the present Spring codebase,
|
||||
|
||||
@@ -2047,7 +2047,7 @@ public abstract class AnnotationUtils {
|
||||
* @see #getAttributeAliasNames
|
||||
* @see #getAttributeOverrideName
|
||||
*/
|
||||
private static class AliasDescriptor {
|
||||
private static final class AliasDescriptor {
|
||||
|
||||
private final Method sourceAttribute;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.util.MimeTypeUtils;
|
||||
* @since 5.0
|
||||
* @see StringDecoder
|
||||
*/
|
||||
public class CharSequenceEncoder extends AbstractEncoder<CharSequence> {
|
||||
public final class CharSequenceEncoder extends AbstractEncoder<CharSequence> {
|
||||
|
||||
/**
|
||||
* The default charset used by the encoder.
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.springframework.util.MimeTypeUtils;
|
||||
* @since 5.0
|
||||
* @see CharSequenceEncoder
|
||||
*/
|
||||
public class StringDecoder extends AbstractDataBufferDecoder<String> {
|
||||
public final class StringDecoder extends AbstractDataBufferDecoder<String> {
|
||||
|
||||
private static final DataBuffer END_FRAME = new DefaultDataBufferFactory().wrap(new byte[0]);
|
||||
|
||||
|
||||
@@ -31,7 +31,10 @@ import org.springframework.util.StringUtils;
|
||||
* @author Phillip Webb
|
||||
* @since 5.1
|
||||
*/
|
||||
class ProfilesParser {
|
||||
final class ProfilesParser {
|
||||
|
||||
private ProfilesParser() {
|
||||
}
|
||||
|
||||
static Profiles parse(String... expressions) {
|
||||
Assert.notEmpty(expressions, "Must specify at least one profile");
|
||||
|
||||
@@ -57,6 +57,27 @@ public abstract class ReflectionUtils {
|
||||
|
||||
private static final Field[] NO_FIELDS = {};
|
||||
|
||||
/**
|
||||
* Pre-built FieldFilter that matches all non-static, non-final fields.
|
||||
*/
|
||||
public static final FieldFilter COPYABLE_FIELDS =
|
||||
field -> !(Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers()));
|
||||
|
||||
|
||||
/**
|
||||
* Pre-built MethodFilter that matches all non-bridge methods.
|
||||
*/
|
||||
public static final MethodFilter NON_BRIDGED_METHODS =
|
||||
(method -> !method.isBridge());
|
||||
|
||||
|
||||
/**
|
||||
* Pre-built MethodFilter that matches all non-bridge non-synthetic methods
|
||||
* which are not declared on {@code java.lang.Object}.
|
||||
*/
|
||||
public static final MethodFilter USER_DECLARED_METHODS =
|
||||
(method -> (!method.isBridge() && !method.isSynthetic() && method.getDeclaringClass() != Object.class));
|
||||
|
||||
|
||||
/**
|
||||
* Cache for {@link Class#getDeclaredMethods()} plus equivalent default methods
|
||||
@@ -847,25 +868,4 @@ public abstract class ReflectionUtils {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pre-built FieldFilter that matches all non-static, non-final fields.
|
||||
*/
|
||||
public static final FieldFilter COPYABLE_FIELDS =
|
||||
field -> !(Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers()));
|
||||
|
||||
|
||||
/**
|
||||
* Pre-built MethodFilter that matches all non-bridge methods.
|
||||
*/
|
||||
public static final MethodFilter NON_BRIDGED_METHODS =
|
||||
(method -> !method.isBridge());
|
||||
|
||||
|
||||
/**
|
||||
* Pre-built MethodFilter that matches all non-bridge non-synthetic methods
|
||||
* which are not declared on {@code java.lang.Object}.
|
||||
*/
|
||||
public static final MethodFilter USER_DECLARED_METHODS =
|
||||
(method -> (!method.isBridge() && !method.isSynthetic() && method.getDeclaringClass() != Object.class));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user