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:
Phillip Webb 2018-06-20 19:44:39 -07:00 committed by Juergen Hoeller
parent 0ad0f341bd
commit eeebd51f57
128 changed files with 656 additions and 455 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import java.io.Serializable;
* @author Rod Johnson * @author Rod Johnson
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class TrueClassFilter implements ClassFilter, Serializable { final class TrueClassFilter implements ClassFilter, Serializable {
public static final TrueClassFilter INSTANCE = new TrueClassFilter(); public static final TrueClassFilter INSTANCE = new TrueClassFilter();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ import org.springframework.lang.Nullable;
* @author Rod Johnson * @author Rod Johnson
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class TrueMethodMatcher implements MethodMatcher, Serializable { final class TrueMethodMatcher implements MethodMatcher, Serializable {
public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher(); public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher();

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import java.io.Serializable;
* @author Rod Johnson * @author Rod Johnson
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class TruePointcut implements Pointcut, Serializable { final class TruePointcut implements Pointcut, Serializable {
public static final TruePointcut INSTANCE = new TruePointcut(); public static final TruePointcut INSTANCE = new TruePointcut();

View File

@ -561,6 +561,19 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
return sb.toString(); return sb.toString();
} }
//---------------------------------------------------------------------
// Serialization support
//---------------------------------------------------------------------
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Rely on default serialization, just initialize state after deserialization.
ois.defaultReadObject();
// Initialize transient fields.
// pointcutExpression will be initialized lazily by checkReadyToMatch()
this.shadowMatchCache = new ConcurrentHashMap<>(32);
}
/** /**
* Handler for the Spring-specific {@code bean()} pointcut designator * Handler for the Spring-specific {@code bean()} pointcut designator
@ -657,20 +670,6 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
} }
//---------------------------------------------------------------------
// Serialization support
//---------------------------------------------------------------------
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
// Rely on default serialization, just initialize state after deserialization.
ois.defaultReadObject();
// Initialize transient fields.
// pointcutExpression will be initialized lazily by checkReadyToMatch()
this.shadowMatchCache = new ConcurrentHashMap<>(32);
}
private static class DefensiveShadowMatch implements ShadowMatch { private static class DefensiveShadowMatch implements ShadowMatch {
private final ShadowMatch primary; private final ShadowMatch primary;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -42,7 +42,7 @@ import org.springframework.lang.Nullable;
* @since 2.0 * @since 2.0
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
class InstantiationModelAwarePointcutAdvisorImpl final class InstantiationModelAwarePointcutAdvisorImpl
implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation, Serializable { implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation, Serializable {
private static final Advice EMPTY_ADVICE = new Advice() {}; private static final Advice EMPTY_ADVICE = new Advice() {};
@ -264,7 +264,7 @@ class InstantiationModelAwarePointcutAdvisorImpl
* Note that this is a <i>dynamic</i> pointcut. Otherwise it might * Note that this is a <i>dynamic</i> pointcut. Otherwise it might
* be optimized out if it does not at first match statically. * be optimized out if it does not at first match statically.
*/ */
private class PerTargetInstantiationModelPointcut extends DynamicMethodMatcherPointcut { private final class PerTargetInstantiationModelPointcut extends DynamicMethodMatcherPointcut {
private final AspectJExpressionPointcut declaredPointcut; private final AspectJExpressionPointcut declaredPointcut;

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,7 @@ import org.springframework.aop.framework.AopConfigException;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class NotAnAtAspectException extends AopConfigException { public class NotAnAtAspectException extends AopConfigException {
private Class<?> nonAspectClass; private final Class<?> nonAspectClass;
/** /**

View File

@ -27,13 +27,17 @@ import org.springframework.lang.Nullable;
* @author Ramnivas Laddad * @author Ramnivas Laddad
* @since 2.5 * @since 2.5
*/ */
public class ProxyCreationContext { public final class ProxyCreationContext {
/** ThreadLocal holding the current proxied bean name during Advisor matching. */ /** ThreadLocal holding the current proxied bean name during Advisor matching. */
private static final ThreadLocal<String> currentProxiedBeanName = private static final ThreadLocal<String> currentProxiedBeanName =
new NamedThreadLocal<>("Name of currently proxied bean"); new NamedThreadLocal<>("Name of currently proxied bean");
private ProxyCreationContext() {
}
/** /**
* Return the name of the currently proxied bean instance. * Return the name of the currently proxied bean instance.
* @return the name of the bean, or {@code null} if none available * @return the name of the bean, or {@code null} if none available

View File

@ -41,7 +41,7 @@ import org.springframework.core.PriorityOrdered;
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ExposeInvocationInterceptor implements MethodInterceptor, PriorityOrdered, Serializable { public final class ExposeInvocationInterceptor implements MethodInterceptor, PriorityOrdered, Serializable {
/** Singleton instance of this class. */ /** Singleton instance of this class. */
public static final ExposeInvocationInterceptor INSTANCE = new ExposeInvocationInterceptor(); public static final ExposeInvocationInterceptor INSTANCE = new ExposeInvocationInterceptor();

View File

@ -30,7 +30,7 @@ import org.springframework.util.ObjectUtils;
* @author Rod Johnson * @author Rod Johnson
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
public class EmptyTargetSource implements TargetSource, Serializable { public final class EmptyTargetSource implements TargetSource, Serializable {
/** use serialVersionUID from Spring 1.2 for interoperability. */ /** use serialVersionUID from Spring 1.2 for interoperability. */
private static final long serialVersionUID = 3680494563553489691L; private static final long serialVersionUID = 3680494563553489691L;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,11 @@ package org.springframework.cache.aspectj;
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
class AnyThrow { final class AnyThrow {
private AnyThrow() {
}
static void throwUnchecked(Throwable e) { static void throwUnchecked(Throwable e) {
AnyThrow.<RuntimeException>throwAny(e); AnyThrow.<RuntimeException>throwAny(e);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,13 +31,13 @@ import org.springframework.lang.Nullable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BeanInstantiationException extends FatalBeanException { public class BeanInstantiationException extends FatalBeanException {
private Class<?> beanClass; private final Class<?> beanClass;
@Nullable @Nullable
private Constructor<?> constructor; private final Constructor<?> constructor;
@Nullable @Nullable
private Method constructingMethod; private final Method constructingMethod;
/** /**
@ -58,6 +58,8 @@ public class BeanInstantiationException extends FatalBeanException {
public BeanInstantiationException(Class<?> beanClass, String msg, @Nullable Throwable cause) { public BeanInstantiationException(Class<?> beanClass, String msg, @Nullable Throwable cause) {
super("Failed to instantiate [" + beanClass.getName() + "]: " + msg, cause); super("Failed to instantiate [" + beanClass.getName() + "]: " + msg, cause);
this.beanClass = beanClass; this.beanClass = beanClass;
this.constructor = null;
this.constructingMethod = null;
} }
/** /**
@ -71,6 +73,7 @@ public class BeanInstantiationException extends FatalBeanException {
super("Failed to instantiate [" + constructor.getDeclaringClass().getName() + "]: " + msg, cause); super("Failed to instantiate [" + constructor.getDeclaringClass().getName() + "]: " + msg, cause);
this.beanClass = constructor.getDeclaringClass(); this.beanClass = constructor.getDeclaringClass();
this.constructor = constructor; this.constructor = constructor;
this.constructingMethod = null;
} }
/** /**
@ -84,6 +87,7 @@ public class BeanInstantiationException extends FatalBeanException {
public BeanInstantiationException(Method constructingMethod, String msg, @Nullable Throwable cause) { public BeanInstantiationException(Method constructingMethod, String msg, @Nullable Throwable cause) {
super("Failed to instantiate [" + constructingMethod.getReturnType().getName() + "]: " + msg, cause); super("Failed to instantiate [" + constructingMethod.getReturnType().getName() + "]: " + msg, cause);
this.beanClass = constructingMethod.getReturnType(); this.beanClass = constructingMethod.getReturnType();
this.constructor = null;
this.constructingMethod = constructingMethod; this.constructingMethod = constructingMethod;
} }

View File

@ -71,7 +71,7 @@ import org.springframework.util.StringUtils;
* @see #clearClassLoader(ClassLoader) * @see #clearClassLoader(ClassLoader)
* @see #forClass(Class) * @see #forClass(Class)
*/ */
public class CachedIntrospectionResults { public final class CachedIntrospectionResults {
/** /**
* System property that instructs Spring to use the {@link Introspector#IGNORE_ALL_BEANINFO} * System property that instructs Spring to use the {@link Introspector#IGNORE_ALL_BEANINFO}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,9 +28,9 @@ import org.springframework.lang.Nullable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class InvalidPropertyException extends FatalBeanException { public class InvalidPropertyException extends FatalBeanException {
private Class<?> beanClass; private final Class<?> beanClass;
private String propertyName; private final String propertyName;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,7 +30,7 @@ import org.springframework.lang.Nullable;
public class NotWritablePropertyException extends InvalidPropertyException { public class NotWritablePropertyException extends InvalidPropertyException {
@Nullable @Nullable
private String[] possibleMatches; private final String[] possibleMatches;
/** /**
@ -42,6 +42,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
super(beanClass, propertyName, super(beanClass, propertyName,
"Bean property '" + propertyName + "' is not writable or has an invalid setter method: " + "Bean property '" + propertyName + "' is not writable or has an invalid setter method: " +
"Does the return type of the getter match the parameter type of the setter?"); "Does the return type of the getter match the parameter type of the setter?");
this.possibleMatches = null;
} }
/** /**
@ -52,6 +53,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
*/ */
public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg) { public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg) {
super(beanClass, propertyName, msg); super(beanClass, propertyName, msg);
this.possibleMatches = null;
} }
/** /**
@ -63,6 +65,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
*/ */
public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg, Throwable cause) { public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg, Throwable cause) {
super(beanClass, propertyName, msg, cause); super(beanClass, propertyName, msg, cause);
this.possibleMatches = null;
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,7 +31,7 @@ import org.springframework.lang.Nullable;
public abstract class PropertyAccessException extends BeansException { public abstract class PropertyAccessException extends BeansException {
@Nullable @Nullable
private transient PropertyChangeEvent propertyChangeEvent; private final PropertyChangeEvent propertyChangeEvent;
/** /**
@ -52,6 +52,7 @@ public abstract class PropertyAccessException extends BeansException {
*/ */
public PropertyAccessException(String msg, @Nullable Throwable cause) { public PropertyAccessException(String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.propertyChangeEvent = null;
} }

View File

@ -40,7 +40,7 @@ import org.springframework.util.ObjectUtils;
public class PropertyBatchUpdateException extends BeansException { public class PropertyBatchUpdateException extends BeansException {
/** List of PropertyAccessException objects. */ /** List of PropertyAccessException objects. */
private PropertyAccessException[] propertyAccessExceptions; private final PropertyAccessException[] propertyAccessExceptions;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,7 +30,12 @@ import org.springframework.util.ObjectUtils;
* @author Chris Beams * @author Chris Beams
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
class PropertyDescriptorUtils { final class PropertyDescriptorUtils {
private PropertyDescriptorUtils() {
}
/** /**
* See {@link java.beans.FeatureDescriptor}. * See {@link java.beans.FeatureDescriptor}.

View File

@ -517,7 +517,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
* Holder for a registered custom editor with property name. * Holder for a registered custom editor with property name.
* Keeps the PropertyEditor itself plus the type it was registered for. * Keeps the PropertyEditor itself plus the type it was registered for.
*/ */
private static class CustomEditorHolder { private static final class CustomEditorHolder {
private final PropertyEditor propertyEditor; private final PropertyEditor propertyEditor;

View File

@ -35,10 +35,10 @@ import org.springframework.lang.Nullable;
public class BeanCreationException extends FatalBeanException { public class BeanCreationException extends FatalBeanException {
@Nullable @Nullable
private String beanName; private final String beanName;
@Nullable @Nullable
private String resourceDescription; private final String resourceDescription;
@Nullable @Nullable
private List<Throwable> relatedCauses; private List<Throwable> relatedCauses;
@ -50,6 +50,8 @@ public class BeanCreationException extends FatalBeanException {
*/ */
public BeanCreationException(String msg) { public BeanCreationException(String msg) {
super(msg); super(msg);
this.beanName = null;
this.resourceDescription = null;
} }
/** /**
@ -59,6 +61,8 @@ public class BeanCreationException extends FatalBeanException {
*/ */
public BeanCreationException(String msg, Throwable cause) { public BeanCreationException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.beanName = null;
this.resourceDescription = null;
} }
/** /**
@ -69,6 +73,7 @@ public class BeanCreationException extends FatalBeanException {
public BeanCreationException(String beanName, String msg) { public BeanCreationException(String beanName, String msg) {
super("Error creating bean with name '" + beanName + "': " + msg); super("Error creating bean with name '" + beanName + "': " + msg);
this.beanName = beanName; this.beanName = beanName;
this.resourceDescription = null;
} }
/** /**
@ -94,6 +99,7 @@ public class BeanCreationException extends FatalBeanException {
(resourceDescription != null ? " defined in " + resourceDescription : "") + ": " + msg); (resourceDescription != null ? " defined in " + resourceDescription : "") + ": " + msg);
this.resourceDescription = resourceDescription; this.resourceDescription = resourceDescription;
this.beanName = beanName; this.beanName = beanName;
this.relatedCauses = null;
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,10 +31,10 @@ import org.springframework.lang.Nullable;
public class BeanDefinitionStoreException extends FatalBeanException { public class BeanDefinitionStoreException extends FatalBeanException {
@Nullable @Nullable
private String resourceDescription; private final String resourceDescription;
@Nullable @Nullable
private String beanName; private final String beanName;
/** /**
@ -43,6 +43,8 @@ public class BeanDefinitionStoreException extends FatalBeanException {
*/ */
public BeanDefinitionStoreException(String msg) { public BeanDefinitionStoreException(String msg) {
super(msg); super(msg);
this.resourceDescription = null;
this.beanName = null;
} }
/** /**
@ -52,6 +54,8 @@ public class BeanDefinitionStoreException extends FatalBeanException {
*/ */
public BeanDefinitionStoreException(String msg, @Nullable Throwable cause) { public BeanDefinitionStoreException(String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.resourceDescription = null;
this.beanName = null;
} }
/** /**
@ -62,6 +66,7 @@ public class BeanDefinitionStoreException extends FatalBeanException {
public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg) { public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg) {
super(msg); super(msg);
this.resourceDescription = resourceDescription; this.resourceDescription = resourceDescription;
this.beanName = null;
} }
/** /**
@ -73,6 +78,7 @@ public class BeanDefinitionStoreException extends FatalBeanException {
public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg, @Nullable Throwable cause) { public BeanDefinitionStoreException(@Nullable String resourceDescription, String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.resourceDescription = resourceDescription; this.resourceDescription = resourceDescription;
this.beanName = null;
} }
/** /**

View File

@ -29,13 +29,13 @@ import org.springframework.util.ClassUtils;
public class BeanNotOfRequiredTypeException extends BeansException { public class BeanNotOfRequiredTypeException extends BeansException {
/** The name of the instance that was of the wrong type. */ /** The name of the instance that was of the wrong type. */
private String beanName; private final String beanName;
/** The required type. */ /** The required type. */
private Class<?> requiredType; private final Class<?> requiredType;
/** The offending type. */ /** The offending type. */
private Class<?> actualType; private final Class<?> actualType;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,13 +30,13 @@ import org.springframework.lang.Nullable;
public class CannotLoadBeanClassException extends FatalBeanException { public class CannotLoadBeanClassException extends FatalBeanException {
@Nullable @Nullable
private String resourceDescription; private final String resourceDescription;
@Nullable @Nullable
private String beanName; private final String beanName;
@Nullable @Nullable
private String beanClassName; private final String beanClassName;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -36,10 +36,10 @@ import org.springframework.lang.Nullable;
public class NoSuchBeanDefinitionException extends BeansException { public class NoSuchBeanDefinitionException extends BeansException {
@Nullable @Nullable
private String beanName; private final String beanName;
@Nullable @Nullable
private ResolvableType resolvableType; private final ResolvableType resolvableType;
/** /**
@ -49,6 +49,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
public NoSuchBeanDefinitionException(String name) { public NoSuchBeanDefinitionException(String name) {
super("No bean named '" + name + "' available"); super("No bean named '" + name + "' available");
this.beanName = name; this.beanName = name;
this.resolvableType = null;
} }
/** /**
@ -59,6 +60,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
public NoSuchBeanDefinitionException(String name, String message) { public NoSuchBeanDefinitionException(String name, String message) {
super("No bean named '" + name + "' available: " + message); super("No bean named '" + name + "' available: " + message);
this.beanName = name; this.beanName = name;
this.resolvableType = null;
} }
/** /**
@ -85,6 +87,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
*/ */
public NoSuchBeanDefinitionException(ResolvableType type) { public NoSuchBeanDefinitionException(ResolvableType type) {
super("No qualifying bean of type '" + type + "' available"); super("No qualifying bean of type '" + type + "' available");
this.beanName = null;
this.resolvableType = type; this.resolvableType = type;
} }
@ -96,6 +99,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
*/ */
public NoSuchBeanDefinitionException(ResolvableType type, String message) { public NoSuchBeanDefinitionException(ResolvableType type, String message) {
super("No qualifying bean of type '" + type + "' available: " + message); super("No qualifying bean of type '" + type + "' available: " + message);
this.beanName = null;
this.resolvableType = type; this.resolvableType = type;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,10 +33,10 @@ import org.springframework.util.StringUtils;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionException { public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionException {
private int numberOfBeansFound; private final int numberOfBeansFound;
@Nullable @Nullable
private Collection<String> beanNamesFound; private final Collection<String> beanNamesFound;
/** /**
@ -48,6 +48,7 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti
public NoUniqueBeanDefinitionException(Class<?> type, int numberOfBeansFound, String message) { public NoUniqueBeanDefinitionException(Class<?> type, int numberOfBeansFound, String message) {
super(type, message); super(type, message);
this.numberOfBeansFound = numberOfBeansFound; this.numberOfBeansFound = numberOfBeansFound;
this.beanNamesFound = null;
} }
/** /**
@ -56,8 +57,9 @@ public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionExcepti
* @param beanNamesFound the names of all matching beans (as a Collection) * @param beanNamesFound the names of all matching beans (as a Collection)
*/ */
public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound) { public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound) {
this(type, beanNamesFound.size(), "expected single matching bean but found " + beanNamesFound.size() + ": " + super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
StringUtils.collectionToCommaDelimitedString(beanNamesFound)); StringUtils.collectionToCommaDelimitedString(beanNamesFound));
this.numberOfBeansFound = beanNamesFound.size();
this.beanNamesFound = beanNamesFound; this.beanNamesFound = beanNamesFound;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,7 +33,7 @@ import org.springframework.util.StringUtils;
public class UnsatisfiedDependencyException extends BeanCreationException { public class UnsatisfiedDependencyException extends BeanCreationException {
@Nullable @Nullable
private InjectionPoint injectionPoint; private final InjectionPoint injectionPoint;
/** /**
@ -49,6 +49,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
super(resourceDescription, beanName, super(resourceDescription, beanName,
"Unsatisfied dependency expressed through bean property '" + propertyName + "'" + "Unsatisfied dependency expressed through bean property '" + propertyName + "'" +
(StringUtils.hasLength(msg) ? ": " + msg : "")); (StringUtils.hasLength(msg) ? ": " + msg : ""));
this.injectionPoint = null;
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -250,7 +250,7 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
} }
private class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver { private final class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver {
private final Properties props; private final Properties props;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.util.ObjectUtils;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 2.0 * @since 2.0
*/ */
public class BeanDefinitionBuilder { public final class BeanDefinitionBuilder {
/** /**
* Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}. * Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,7 +35,7 @@ import org.springframework.util.StringUtils;
* @see PropertiesBeanDefinitionReader * @see PropertiesBeanDefinitionReader
* @see org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader * @see org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader
*/ */
public class BeanDefinitionReaderUtils { public final class BeanDefinitionReaderUtils {
/** /**
* Separator for generated bean names. If a class name or parent name is not * Separator for generated bean names. If a class name or parent name is not
@ -44,6 +44,10 @@ public class BeanDefinitionReaderUtils {
public static final String GENERATED_BEAN_NAME_SEPARATOR = BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR; public static final String GENERATED_BEAN_NAME_SEPARATOR = BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR;
private BeanDefinitionReaderUtils() {
}
/** /**
* Create a new GenericBeanDefinition for the given parent name and class name, * Create a new GenericBeanDefinition for the given parent name and class name,
* eagerly loading the bean class if a ClassLoader has been specified. * eagerly loading the bean class if a ClassLoader has been specified.

View File

@ -37,7 +37,7 @@ public class MailSendException extends MailException {
private final transient Map<Object, Exception> failedMessages; private final transient Map<Object, Exception> failedMessages;
@Nullable @Nullable
private Exception[] messageExceptions; private final Exception[] messageExceptions;
/** /**
@ -56,6 +56,7 @@ public class MailSendException extends MailException {
public MailSendException(String msg, @Nullable Throwable cause) { public MailSendException(String msg, @Nullable Throwable cause) {
super(msg, cause); super(msg, cause);
this.failedMessages = new LinkedHashMap<>(); this.failedMessages = new LinkedHashMap<>();
this.messageExceptions = null;
} }
/** /**

View File

@ -22,7 +22,7 @@ package org.springframework.cache.config;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 4.1 * @since 4.1
*/ */
public class CacheManagementConfigUtils { public final class CacheManagementConfigUtils {
/** /**
* The name of the cache advisor bean. * The name of the cache advisor bean.
@ -48,4 +48,8 @@ public class CacheManagementConfigUtils {
public static final String JCACHE_ASPECT_BEAN_NAME = public static final String JCACHE_ASPECT_BEAN_NAME =
"org.springframework.cache.config.internalJCacheAspect"; "org.springframework.cache.config.internalJCacheAspect";
private CacheManagementConfigUtils() {
}
} }

View File

@ -60,7 +60,7 @@ import org.springframework.util.ClassUtils;
* @see org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor * @see org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor
* @see org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor * @see org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
*/ */
public class AnnotationConfigUtils { public final class AnnotationConfigUtils {
/** /**
* The bean name of the internally managed Configuration annotation processor. * The bean name of the internally managed Configuration annotation processor.
@ -127,6 +127,10 @@ public class AnnotationConfigUtils {
ClassUtils.isPresent(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, AnnotationConfigUtils.class.getClassLoader()); ClassUtils.isPresent(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, AnnotationConfigUtils.class.getClassLoader());
private AnnotationConfigUtils() {
}
/** /**
* Register all relevant annotation post processors in the given registry. * Register all relevant annotation post processors in the given registry.
* @param registry the registry to operate on * @param registry the registry to operate on

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,12 @@ import org.springframework.core.annotation.AnnotatedElementUtils;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 3.1 * @since 3.1
*/ */
class BeanAnnotationHelper { final class BeanAnnotationHelper {
private BeanAnnotationHelper() {
}
public static boolean isBeanAnnotated(Method method) { public static boolean isBeanAnnotated(Method method) {
return AnnotatedElementUtils.hasAnnotation(method, Bean.class); return AnnotatedElementUtils.hasAnnotation(method, Bean.class);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,12 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
* @since 3.0 * @since 3.0
* @see org.springframework.aop.scope.ScopedProxyUtils#createScopedProxy * @see org.springframework.aop.scope.ScopedProxyUtils#createScopedProxy
*/ */
class ScopedProxyCreator { final class ScopedProxyCreator {
private ScopedProxyCreator() {
}
public static BeanDefinitionHolder createScopedProxy( public static BeanDefinitionHolder createScopedProxy(
BeanDefinitionHolder definitionHolder, BeanDefinitionRegistry registry, boolean proxyTargetClass) { BeanDefinitionHolder definitionHolder, BeanDefinitionRegistry registry, boolean proxyTargetClass) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -39,7 +39,7 @@ import org.springframework.util.ConcurrentReferenceHashMap;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 5.0 * @since 5.0
*/ */
public class CandidateComponentsIndexLoader { public final class CandidateComponentsIndexLoader {
/** /**
* The location to look for components. * The location to look for components.
@ -67,6 +67,10 @@ public class CandidateComponentsIndexLoader {
new ConcurrentReferenceHashMap<>(); new ConcurrentReferenceHashMap<>();
private CandidateComponentsIndexLoader() {
}
/** /**
* Load and instantiate the {@link CandidateComponentsIndex} from * Load and instantiate the {@link CandidateComponentsIndex} from
* {@value #COMPONENTS_RESOURCE_LOCATION}, using the given class loader. If no * {@value #COMPONENTS_RESOURCE_LOCATION}, using the given class loader. If no

View File

@ -48,7 +48,12 @@ import org.springframework.lang.Nullable;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 4.0 * @since 4.0
*/ */
class PostProcessorRegistrationDelegate { final class PostProcessorRegistrationDelegate {
private PostProcessorRegistrationDelegate() {
}
public static void invokeBeanFactoryPostProcessors( public static void invokeBeanFactoryPostProcessors(
ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) { ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,6 +38,10 @@ public final class JodaTimeContextHolder {
new NamedThreadLocal<>("JodaTimeContext"); new NamedThreadLocal<>("JodaTimeContext");
private JodaTimeContextHolder() {
}
/** /**
* Reset the JodaTimeContext for the current thread. * Reset the JodaTimeContext for the current thread.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -46,6 +46,11 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
*/ */
final class JodaTimeConverters { final class JodaTimeConverters {
private JodaTimeConverters() {
}
/** /**
* Install the converters into the converter registry. * Install the converters into the converter registry.
* @param registry the converter registry * @param registry the converter registry

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,6 +35,10 @@ public final class DateTimeContextHolder {
new NamedThreadLocal<>("DateTimeContext"); new NamedThreadLocal<>("DateTimeContext");
private DateTimeContextHolder() {
}
/** /**
* Reset the DateTimeContext for the current thread. * Reset the DateTimeContext for the current thread.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -43,6 +43,11 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
*/ */
final class DateTimeConverters { final class DateTimeConverters {
private DateTimeConverters() {
}
/** /**
* Install the converters into the converter registry. * Install the converters into the converter registry.
* @param registry the converter registry * @param registry the converter registry

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,12 @@ import javax.management.ObjectName;
* @since 1.2 * @since 1.2
* @see javax.management.ObjectName#getInstance(String) * @see javax.management.ObjectName#getInstance(String)
*/ */
public class ObjectNameManager { public final class ObjectNameManager {
private ObjectNameManager() {
}
/** /**
* Retrieve the {@code ObjectName} instance corresponding to the supplied name. * Retrieve the {@code ObjectName} instance corresponding to the supplied name.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ package org.springframework.scheduling.config;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 4.1 * @since 4.1
*/ */
public class TaskManagementConfigUtils { public final class TaskManagementConfigUtils {
/** /**
* The bean name of the internally managed Scheduled annotation processor. * The bean name of the internally managed Scheduled annotation processor.
@ -42,4 +42,9 @@ public class TaskManagementConfigUtils {
public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME = public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME =
"org.springframework.scheduling.config.internalAsyncExecutionAspect"; "org.springframework.scheduling.config.internalAsyncExecutionAspect";
private TaskManagementConfigUtils() {
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
public class ScriptCompilationException extends NestedRuntimeException { public class ScriptCompilationException extends NestedRuntimeException {
@Nullable @Nullable
private ScriptSource scriptSource; private final ScriptSource scriptSource;
/** /**
@ -38,6 +38,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
*/ */
public ScriptCompilationException(String msg) { public ScriptCompilationException(String msg) {
super(msg); super(msg);
this.scriptSource = null;
} }
/** /**
@ -47,6 +48,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
*/ */
public ScriptCompilationException(String msg, Throwable cause) { public ScriptCompilationException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.scriptSource = null;
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -225,7 +225,7 @@ public abstract class BshScriptUtils {
* Exception to be thrown on script execution failure. * Exception to be thrown on script execution failure.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class BshExecutionException extends NestedRuntimeException { public static final class BshExecutionException extends NestedRuntimeException {
private BshExecutionException(EvalError ex) { private BshExecutionException(EvalError ex) {
super("BeanShell script execution failed", ex); super("BeanShell script execution failed", ex);

View File

@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.0 * @since 5.0
*/ */
public class ReactiveTypeDescriptor { public final class ReactiveTypeDescriptor {
private final Class<?> reactiveType; private final Class<?> reactiveType;

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * @author Juergen Hoeller
* @since 1.1 * @since 1.1
*/ */
public class SpringVersion { public final class SpringVersion {
private SpringVersion() {
}
/** /**
* Return the full version string of the present Spring codebase, * Return the full version string of the present Spring codebase,

View File

@ -2047,7 +2047,7 @@ public abstract class AnnotationUtils {
* @see #getAttributeAliasNames * @see #getAttributeAliasNames
* @see #getAttributeOverrideName * @see #getAttributeOverrideName
*/ */
private static class AliasDescriptor { private static final class AliasDescriptor {
private final Method sourceAttribute; private final Method sourceAttribute;

View File

@ -42,7 +42,7 @@ import org.springframework.util.MimeTypeUtils;
* @since 5.0 * @since 5.0
* @see StringDecoder * @see StringDecoder
*/ */
public class CharSequenceEncoder extends AbstractEncoder<CharSequence> { public final class CharSequenceEncoder extends AbstractEncoder<CharSequence> {
/** /**
* The default charset used by the encoder. * The default charset used by the encoder.

View File

@ -53,7 +53,7 @@ import org.springframework.util.MimeTypeUtils;
* @since 5.0 * @since 5.0
* @see CharSequenceEncoder * @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]); private static final DataBuffer END_FRAME = new DefaultDataBufferFactory().wrap(new byte[0]);

View File

@ -31,7 +31,10 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb * @author Phillip Webb
* @since 5.1 * @since 5.1
*/ */
class ProfilesParser { final class ProfilesParser {
private ProfilesParser() {
}
static Profiles parse(String... expressions) { static Profiles parse(String... expressions) {
Assert.notEmpty(expressions, "Must specify at least one profile"); Assert.notEmpty(expressions, "Must specify at least one profile");

View File

@ -57,6 +57,27 @@ public abstract class ReflectionUtils {
private static final Field[] NO_FIELDS = {}; 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 * 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));
} }

View File

@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
public class ExpressionException extends RuntimeException { public class ExpressionException extends RuntimeException {
@Nullable @Nullable
protected String expressionString; protected final String expressionString;
protected int position; // -1 if not known; should be known in all reasonable cases protected int position; // -1 if not known; should be known in all reasonable cases
@ -40,6 +40,8 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(String message) { public ExpressionException(String message) {
super(message); super(message);
this.expressionString = null;
this.position = 0;
} }
/** /**
@ -49,6 +51,8 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(String message, Throwable cause) { public ExpressionException(String message, Throwable cause) {
super(message, cause); super(message, cause);
this.expressionString = null;
this.position = 0;
} }
/** /**
@ -81,6 +85,7 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(int position, String message) { public ExpressionException(int position, String message) {
super(message); super(message);
this.expressionString = null;
this.position = position; this.position = position;
} }
@ -92,6 +97,7 @@ public class ExpressionException extends RuntimeException {
*/ */
public ExpressionException(int position, String message, Throwable cause) { public ExpressionException(int position, String message, Throwable cause) {
super(message, cause); super(message, cause);
this.expressionString = null;
this.position = position; this.position = position;
} }

View File

@ -1009,6 +1009,21 @@ public class CodeFlow implements Opcodes {
} }
} }
public static final String toBoxedDescriptor(String primitiveDescriptor) {
switch (primitiveDescriptor.charAt(0)) {
case 'I': return "Ljava/lang/Integer";
case 'J': return "Ljava/lang/Long";
case 'F': return "Ljava/lang/Float";
case 'D': return "Ljava/lang/Double";
case 'B': return "Ljava/lang/Byte";
case 'C': return "Ljava/lang/Character";
case 'S': return "Ljava/lang/Short";
case 'Z': return "Ljava/lang/Boolean";
default:
throw new IllegalArgumentException("Unexpected non primitive descriptor "+primitiveDescriptor);
}
}
/** /**
* Interface used to generate fields. * Interface used to generate fields.
@ -1029,19 +1044,5 @@ public class CodeFlow implements Opcodes {
void generateCode(MethodVisitor mv, CodeFlow codeflow); void generateCode(MethodVisitor mv, CodeFlow codeflow);
} }
public static String toBoxedDescriptor(String primitiveDescriptor) {
switch (primitiveDescriptor.charAt(0)) {
case 'I': return "Ljava/lang/Integer";
case 'J': return "Ljava/lang/Long";
case 'F': return "Ljava/lang/Float";
case 'D': return "Ljava/lang/Double";
case 'B': return "Ljava/lang/Byte";
case 'C': return "Ljava/lang/Character";
case 'S': return "Ljava/lang/Short";
case 'Z': return "Ljava/lang/Boolean";
default:
throw new IllegalArgumentException("Unexpected non primitive descriptor "+primitiveDescriptor);
}
}
} }

View File

@ -237,7 +237,7 @@ public abstract class Operator extends SpelNodeImpl {
* A descriptor comparison encapsulates the result of comparing descriptor * A descriptor comparison encapsulates the result of comparing descriptor
* for two operands and describes at what level they are compatible. * for two operands and describes at what level they are compatible.
*/ */
protected static class DescriptorComparison { protected static final class DescriptorComparison {
static final DescriptorComparison NOT_NUMBERS = new DescriptorComparison(false, false, ' '); static final DescriptorComparison NOT_NUMBERS = new DescriptorComparison(false, false, ' ');

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,7 +64,7 @@ import org.springframework.util.ReflectionUtils;
* @author Andy Clement * @author Andy Clement
* @since 4.1 * @since 4.1
*/ */
public class SpelCompiler implements Opcodes { public final class SpelCompiler implements Opcodes {
private static final Log logger = LogFactory.getLog(SpelCompiler.class); private static final Log logger = LogFactory.getLog(SpelCompiler.class);

View File

@ -24,7 +24,7 @@ import org.springframework.expression.TypedValue;
* @author Andy Clement * @author Andy Clement
* @since 3.0 * @since 3.0
*/ */
public class BooleanTypedValue extends TypedValue { public final class BooleanTypedValue extends TypedValue {
/** /**
* True. * True.

View File

@ -39,7 +39,7 @@ import org.springframework.lang.Nullable;
* @see #forInstanceMethodInvocation() * @see #forInstanceMethodInvocation()
* @see DataBindingPropertyAccessor * @see DataBindingPropertyAccessor
*/ */
public class DataBindingMethodResolver extends ReflectiveMethodResolver { public final class DataBindingMethodResolver extends ReflectiveMethodResolver {
private DataBindingMethodResolver() { private DataBindingMethodResolver() {
super(); super();

View File

@ -37,7 +37,7 @@ import java.lang.reflect.Method;
* @see StandardEvaluationContext * @see StandardEvaluationContext
* @see ReflectivePropertyAccessor * @see ReflectivePropertyAccessor
*/ */
public class DataBindingPropertyAccessor extends ReflectivePropertyAccessor { public final class DataBindingPropertyAccessor extends ReflectivePropertyAccessor {
/** /**
* Create a new property accessor for reading and possibly also writing. * Create a new property accessor for reading and possibly also writing.

View File

@ -86,7 +86,7 @@ import org.springframework.lang.Nullable;
* @see StandardTypeConverter * @see StandardTypeConverter
* @see DataBindingPropertyAccessor * @see DataBindingPropertyAccessor
*/ */
public class SimpleEvaluationContext implements EvaluationContext { public final class SimpleEvaluationContext implements EvaluationContext {
private static final TypeLocator typeNotFoundTypeLocator = typeName -> { private static final TypeLocator typeNotFoundTypeLocator = typeName -> {
throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName); throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,11 +27,15 @@ import java.lang.instrument.Instrumentation;
* @since 2.0 * @since 2.0
* @see org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver * @see org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
*/ */
public class InstrumentationSavingAgent { public final class InstrumentationSavingAgent {
private static volatile Instrumentation instrumentation; private static volatile Instrumentation instrumentation;
private InstrumentationSavingAgent() {
}
/** /**
* Save the {@link Instrumentation} interface exposed by the JVM. * Save the {@link Instrumentation} interface exposed by the JVM.
*/ */

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException { public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException {
private String sql; private final String sql;
/** /**

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,9 +29,9 @@ import org.springframework.dao.DataRetrievalFailureException;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class IncorrectResultSetColumnCountException extends DataRetrievalFailureException { public class IncorrectResultSetColumnCountException extends DataRetrievalFailureException {
private int expectedCount; private final int expectedCount;
private int actualCount; private final int actualCount;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -37,7 +37,7 @@ import org.springframework.lang.Nullable;
public class InvalidResultSetAccessException extends InvalidDataAccessResourceUsageException { public class InvalidResultSetAccessException extends InvalidDataAccessResourceUsageException {
@Nullable @Nullable
private String sql; private final String sql;
/** /**
@ -57,6 +57,7 @@ public class InvalidResultSetAccessException extends InvalidDataAccessResourceUs
*/ */
public InvalidResultSetAccessException(SQLException ex) { public InvalidResultSetAccessException(SQLException ex) {
super(ex.getMessage(), ex); super(ex.getMessage(), ex);
this.sql = null;
} }

View File

@ -30,10 +30,10 @@ import org.springframework.dao.IncorrectUpdateSemanticsDataAccessException;
public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectUpdateSemanticsDataAccessException { public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectUpdateSemanticsDataAccessException {
/** Number of rows that should have been affected. */ /** Number of rows that should have been affected. */
private int expected; private final int expected;
/** Number of rows that actually were affected. */ /** Number of rows that actually were affected. */
private int actual; private final int actual;
/** /**

View File

@ -38,7 +38,12 @@ import org.springframework.util.xml.DomUtils;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 3.1 * @since 3.1
*/ */
class DatabasePopulatorConfigUtils { final class DatabasePopulatorConfigUtils {
private DatabasePopulatorConfigUtils() {
}
public static void setDatabasePopulator(Element element, BeanDefinitionBuilder builder) { public static void setDatabasePopulator(Element element, BeanDefinitionBuilder builder) {
List<Element> scripts = DomUtils.getChildElementsByTagName(element, "script"); List<Element> scripts = DomUtils.getChildElementsByTagName(element, "script");

View File

@ -35,7 +35,7 @@ import org.springframework.jdbc.support.MetaDataAccessException;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 2.5 * @since 2.5
*/ */
public class CallMetaDataProviderFactory { public final class CallMetaDataProviderFactory {
/** List of supported database products for procedure calls. */ /** List of supported database products for procedure calls. */
public static final List<String> supportedDatabaseProductsForProcedures = Arrays.asList( public static final List<String> supportedDatabaseProductsForProcedures = Arrays.asList(
@ -59,6 +59,10 @@ public class CallMetaDataProviderFactory {
private static final Log logger = LogFactory.getLog(CallMetaDataProviderFactory.class); private static final Log logger = LogFactory.getLog(CallMetaDataProviderFactory.class);
private CallMetaDataProviderFactory() {
}
/** /**
* Create a {@link CallMetaDataProvider} based on the database meta-data. * Create a {@link CallMetaDataProvider} based on the database meta-data.
* @param dataSource the JDBC DataSource to use for retrieving meta-data * @param dataSource the JDBC DataSource to use for retrieving meta-data

View File

@ -32,11 +32,15 @@ import org.springframework.jdbc.support.MetaDataAccessException;
* @author Thomas Risberg * @author Thomas Risberg
* @since 2.5 * @since 2.5
*/ */
public class TableMetaDataProviderFactory { public final class TableMetaDataProviderFactory {
private static final Log logger = LogFactory.getLog(TableMetaDataProviderFactory.class); private static final Log logger = LogFactory.getLog(TableMetaDataProviderFactory.class);
private TableMetaDataProviderFactory() {
}
/** /**
* Create a {@link TableMetaDataProvider} based on the database meta-data. * Create a {@link TableMetaDataProvider} based on the database meta-data.
* @param dataSource used to retrieve meta-data * @param dataSource used to retrieve meta-data

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -202,7 +202,7 @@ public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
/** /**
* Inner class used as ThreadLocal value. * Inner class used as ThreadLocal value.
*/ */
private static class JdbcUserCredentials { private static final class JdbcUserCredentials {
public final String username; public final String username;

View File

@ -29,6 +29,11 @@ import org.springframework.util.Assert;
*/ */
final class EmbeddedDatabaseConfigurerFactory { final class EmbeddedDatabaseConfigurerFactory {
private EmbeddedDatabaseConfigurerFactory() {
}
/** /**
* Return a configurer instance for the given embedded database type. * Return a configurer instance for the given embedded database type.
* @param type the embedded database type (HSQL, H2 or Derby) * @param type the embedded database type (HSQL, H2 or Derby)

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,12 @@ import java.io.OutputStream;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 3.0 * @since 3.0
*/ */
public class OutputStreamFactory { public final class OutputStreamFactory {
private OutputStreamFactory() {
}
/** /**
* Returns an {@link java.io.OutputStream} that ignores all data given to it. * Returns an {@link java.io.OutputStream} that ignores all data given to it.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,7 +33,7 @@ import org.springframework.lang.Nullable;
* @since 3.1.1 * @since 3.1.1
* @see SQLErrorCodesFactory * @see SQLErrorCodesFactory
*/ */
public class CustomSQLExceptionTranslatorRegistry { public final class CustomSQLExceptionTranslatorRegistry {
private static final Log logger = LogFactory.getLog(CustomSQLExceptionTranslatorRegistry.class); private static final Log logger = LogFactory.getLog(CustomSQLExceptionTranslatorRegistry.class);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -320,17 +320,19 @@ public class UserCredentialsConnectionFactoryAdapter
/** /**
* Inner class used as ThreadLocal value. * Inner class used as ThreadLocal value.
*/ */
private static class JmsUserCredentials { private static final class JmsUserCredentials {
public final String username; public final String username;
public final String password; public final String password;
private JmsUserCredentials(String username, String password) { private JmsUserCredentials(String username, String password) {
this.username = username; this.username = username;
this.password = password; this.password = password;
} }
@Override @Override
public String toString() { public String toString() {
return "JmsUserCredentials[username='" + this.username + "',password='" + this.password + "']"; return "JmsUserCredentials[username='" + this.username + "',password='" + this.password + "']";

View File

@ -78,7 +78,7 @@ public class DestinationVariableMethodArgumentResolver extends AbstractNamedValu
} }
private static class DestinationVariableNamedValueInfo extends NamedValueInfo { private static final class DestinationVariableNamedValueInfo extends NamedValueInfo {
private DestinationVariableNamedValueInfo(DestinationVariable annotation) { private DestinationVariableNamedValueInfo(DestinationVariable annotation) {
super(annotation.value(), true, ValueConstants.DEFAULT_NONE); super(annotation.value(), true, ValueConstants.DEFAULT_NONE);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -106,7 +106,7 @@ public class HeaderMethodArgumentResolver extends AbstractNamedValueMethodArgume
} }
private static class HeaderNamedValueInfo extends NamedValueInfo { private static final class HeaderNamedValueInfo extends NamedValueInfo {
private HeaderNamedValueInfo(Header annotation) { private HeaderNamedValueInfo(Header annotation) {
super(annotation.name(), annotation.required(), annotation.defaultValue()); super(annotation.name(), annotation.required(), annotation.defaultValue());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.validation.ObjectError;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class MethodArgumentNotValidException extends MethodArgumentResolutionException { public class MethodArgumentNotValidException extends MethodArgumentResolutionException {
private BindingResult bindingResult; private final BindingResult bindingResult;
/** /**
@ -42,6 +42,7 @@ public class MethodArgumentNotValidException extends MethodArgumentResolutionExc
*/ */
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter) { public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter) {
super(message, parameter); super(message, parameter);
this.bindingResult = null;
} }
/** /**

View File

@ -577,7 +577,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
private volatile boolean isStompConnected; private volatile boolean isStompConnected;
private StompConnectionHandler(String sessionId, StompHeaderAccessor connectHeaders) { protected StompConnectionHandler(String sessionId, StompHeaderAccessor connectHeaders) {
this(sessionId, connectHeaders, true); this(sessionId, connectHeaders, true);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,10 +30,10 @@ import org.springframework.lang.Nullable;
public class ObjectOptimisticLockingFailureException extends OptimisticLockingFailureException { public class ObjectOptimisticLockingFailureException extends OptimisticLockingFailureException {
@Nullable @Nullable
private Object persistentClass; private final Object persistentClass;
@Nullable @Nullable
private Object identifier; private final Object identifier;
/** /**
@ -44,6 +44,8 @@ public class ObjectOptimisticLockingFailureException extends OptimisticLockingFa
*/ */
public ObjectOptimisticLockingFailureException(String msg, Throwable cause) { public ObjectOptimisticLockingFailureException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.persistentClass = null;
this.identifier = null;
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,10 +30,10 @@ import org.springframework.lang.Nullable;
public class ObjectRetrievalFailureException extends DataRetrievalFailureException { public class ObjectRetrievalFailureException extends DataRetrievalFailureException {
@Nullable @Nullable
private Object persistentClass; private final Object persistentClass;
@Nullable @Nullable
private Object identifier; private final Object identifier;
/** /**
@ -44,6 +44,8 @@ public class ObjectRetrievalFailureException extends DataRetrievalFailureExcepti
*/ */
public ObjectRetrievalFailureException(String msg, Throwable cause) { public ObjectRetrievalFailureException(String msg, Throwable cause) {
super(msg, cause); super(msg, cause);
this.persistentClass = null;
this.identifier = null;
} }
/** /**

View File

@ -890,7 +890,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* Holder for suspended resources. * Holder for suspended resources.
* Used internally by {@code doSuspend} and {@code doResume}. * Used internally by {@code doSuspend} and {@code doResume}.
*/ */
private static class SuspendedResourcesHolder { private static final class SuspendedResourcesHolder {
private final SessionHolder sessionHolder; private final SessionHolder sessionHolder;

View File

@ -242,7 +242,7 @@ public abstract class ExtendedEntityManagerCreator {
* InvocationHandler for extended EntityManagers as defined in the JPA spec. * InvocationHandler for extended EntityManagers as defined in the JPA spec.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
private static class ExtendedEntityManagerInvocationHandler implements InvocationHandler, Serializable { private static final class ExtendedEntityManagerInvocationHandler implements InvocationHandler, Serializable {
private static final Log logger = LogFactory.getLog(ExtendedEntityManagerInvocationHandler.class); private static final Log logger = LogFactory.getLog(ExtendedEntityManagerInvocationHandler.class);

View File

@ -745,7 +745,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
* Holder for suspended resources. * Holder for suspended resources.
* Used internally by {@code doSuspend} and {@code doResume}. * Used internally by {@code doSuspend} and {@code doResume}.
*/ */
private static class SuspendedResourcesHolder { private static final class SuspendedResourcesHolder {
private final EntityManagerHolder entityManagerHolder; private final EntityManagerHolder entityManagerHolder;

View File

@ -127,6 +127,9 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
private static final String CID = "cid:"; private static final String CID = "cid:";
private static final EntityResolver NO_OP_ENTITY_RESOLVER =
(publicId, systemId) -> new InputSource(new StringReader(""));
/** Logger available to subclasses. */ /** Logger available to subclasses. */
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
@ -1079,8 +1082,4 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
} }
} }
private static final EntityResolver NO_OP_ENTITY_RESOLVER =
(publicId, systemId) -> new InputSource(new StringReader(""));
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -102,7 +102,7 @@ public class MarshallingSource extends SAXSource {
} }
private static class MarshallingXMLReader implements XMLReader { private static final class MarshallingXMLReader implements XMLReader {
private final Marshaller marshaller; private final Marshaller marshaller;

View File

@ -52,7 +52,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 5.0 * @since 5.0
*/ */
public class MockServerHttpRequest extends AbstractServerHttpRequest { public final class MockServerHttpRequest extends AbstractServerHttpRequest {
private final HttpMethod httpMethod; private final HttpMethod httpMethod;

View File

@ -357,7 +357,7 @@ public class SimpleNamingContext implements Context {
} }
private static class NameClassPairEnumeration extends AbstractNamingEnumeration<NameClassPair> { private static final class NameClassPairEnumeration extends AbstractNamingEnumeration<NameClassPair> {
private NameClassPairEnumeration(SimpleNamingContext context, String root) throws NamingException { private NameClassPairEnumeration(SimpleNamingContext context, String root) throws NamingException {
super(context, root); super(context, root);
@ -370,7 +370,7 @@ public class SimpleNamingContext implements Context {
} }
private static class BindingEnumeration extends AbstractNamingEnumeration<Binding> { private static final class BindingEnumeration extends AbstractNamingEnumeration<Binding> {
private BindingEnumeration(SimpleNamingContext context, String root) throws NamingException { private BindingEnumeration(SimpleNamingContext context, String root) throws NamingException {
super(context, root); super(context, root);

View File

@ -150,7 +150,7 @@ public class MockFilterChain implements FilterChain {
/** /**
* A filter that simply delegates to a Servlet. * A filter that simply delegates to a Servlet.
*/ */
private static class ServletFilterProxy implements Filter { private static final class ServletFilterProxy implements Filter {
private final Servlet delegateServlet; private final Servlet delegateServlet;

View File

@ -63,7 +63,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* @author Arjen Poutsma * @author Arjen Poutsma
* @since 5.0 * @since 5.0
*/ */
public class MockServerRequest implements ServerRequest { public final class MockServerRequest implements ServerRequest {
private final HttpMethod method; private final HttpMethod method;

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,7 @@ import org.springframework.util.Assert;
* @author Sam Brannen * @author Sam Brannen
* @since 2.0 * @since 2.0
*/ */
public class SystemProfileValueSource implements ProfileValueSource { public final class SystemProfileValueSource implements ProfileValueSource {
private static final SystemProfileValueSource INSTANCE = new SystemProfileValueSource(); private static final SystemProfileValueSource INSTANCE = new SystemProfileValueSource();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,12 @@ import org.springframework.core.annotation.AnnotatedElementUtils;
* @author Sam Brannen * @author Sam Brannen
* @since 4.2 * @since 4.2
*/ */
public class TestAnnotationUtils { public final class TestAnnotationUtils {
private TestAnnotationUtils() {
}
/** /**
* Get the {@code timeout} configured via the {@link Timed @Timed} * Get the {@code timeout} configured via the {@link Timed @Timed}

View File

@ -38,7 +38,12 @@ import org.springframework.util.Assert;
* @since 4.1 * @since 4.1
* @see TransactionalTestExecutionListener * @see TransactionalTestExecutionListener
*/ */
public class TestTransaction { public final class TestTransaction {
private TestTransaction() {
}
/** /**
* Determine whether a test-managed transaction is currently <em>active</em>. * Determine whether a test-managed transaction is currently <em>active</em>.

View File

@ -25,12 +25,16 @@ import org.springframework.lang.Nullable;
* @author Sam Brannen * @author Sam Brannen
* @since 4.1 * @since 4.1
*/ */
class TransactionContextHolder { final class TransactionContextHolder {
private static final ThreadLocal<TransactionContext> currentTransactionContext = private static final ThreadLocal<TransactionContext> currentTransactionContext =
new NamedInheritableThreadLocal<>("Test Transaction Context"); new NamedInheritableThreadLocal<>("Test Transaction Context");
private TransactionContextHolder() {
}
static void setCurrentTransactionContext(TransactionContext transactionContext) { static void setCurrentTransactionContext(TransactionContext transactionContext) {
currentTransactionContext.set(transactionContext); currentTransactionContext.set(transactionContext);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,11 +38,15 @@ import org.springframework.util.StringUtils;
* @see org.springframework.jdbc.datasource.init.ResourceDatabasePopulator * @see org.springframework.jdbc.datasource.init.ResourceDatabasePopulator
* @see org.springframework.jdbc.datasource.init.DatabasePopulatorUtils * @see org.springframework.jdbc.datasource.init.DatabasePopulatorUtils
*/ */
public class JdbcTestUtils { public final class JdbcTestUtils {
private static final Log logger = LogFactory.getLog(JdbcTestUtils.class); private static final Log logger = LogFactory.getLog(JdbcTestUtils.class);
private JdbcTestUtils() {
}
/** /**
* Count the rows in the given table. * Count the rows in the given table.
* @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations * @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,7 +38,7 @@ import org.springframework.util.Assert;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 4.3 * @since 4.3
*/ */
public class ExpectedCount { public final class ExpectedCount {
private final int minCount; private final int minCount;

View File

@ -64,7 +64,7 @@ import org.springframework.web.client.support.RestGatewaySupport;
* @since 3.2 * @since 3.2
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class MockRestServiceServer { public final class MockRestServiceServer {
private final RequestExpectationManager expectationManager; private final RequestExpectationManager expectationManager;

View File

@ -33,7 +33,12 @@ import org.springframework.web.context.WebApplicationContext;
* @see #webAppContextSetup(WebApplicationContext) * @see #webAppContextSetup(WebApplicationContext)
* @see #standaloneSetup(Object...) * @see #standaloneSetup(Object...)
*/ */
public class MockMvcBuilders { public final class MockMvcBuilders {
private MockMvcBuilders() {
}
/** /**
* Build a {@link MockMvc} instance using the given, fully initialized * Build a {@link MockMvc} instance using the given, fully initialized

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,9 +28,9 @@ package org.springframework.dao;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class IncorrectResultSizeDataAccessException extends DataRetrievalFailureException { public class IncorrectResultSizeDataAccessException extends DataRetrievalFailureException {
private int expectedSize; private final int expectedSize;
private int actualSize; private final int actualSize;
/** /**

View File

@ -225,7 +225,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
/** /**
* Invocation handler that suppresses close calls on CCI Connections. * Invocation handler that suppresses close calls on CCI Connections.
*/ */
private static class CloseSuppressingInvocationHandler implements InvocationHandler { private static final class CloseSuppressingInvocationHandler implements InvocationHandler {
private final Connection target; private final Connection target;

View File

@ -65,7 +65,7 @@ public class HeuristicCompletionException extends TransactionException {
/** /**
* The outcome state of the transaction: have some or all resources been committed? * The outcome state of the transaction: have some or all resources been committed?
*/ */
private int outcomeState = STATE_UNKNOWN; private final int outcomeState;
/** /**

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ package org.springframework.transaction;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class InvalidTimeoutException extends TransactionUsageException { public class InvalidTimeoutException extends TransactionUsageException {
private int timeout; private final int timeout;
/** /**

View File

@ -1273,7 +1273,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* Holder for suspended resources. * Holder for suspended resources.
* Used internally by {@code suspend} and {@code resume}. * Used internally by {@code suspend} and {@code resume}.
*/ */
protected static class SuspendedResourcesHolder { protected static final class SuspendedResourcesHolder {
@Nullable @Nullable
private final Object suspendedResources; private final Object suspendedResources;

View File

@ -39,7 +39,7 @@ import static java.time.format.DateTimeFormatter.*;
* @since 5.0 * @since 5.0
* @see <a href="https://tools.ietf.org/html/rfc2183">RFC 2183</a> * @see <a href="https://tools.ietf.org/html/rfc2183">RFC 2183</a>
*/ */
public class ContentDisposition { public final class ContentDisposition {
@Nullable @Nullable
private final String type; private final String type;

Some files were not shown because too many files have changed in this diff Show More