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:
parent
0ad0f341bd
commit
eeebd51f57
|
@ -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.
|
||||
|
@ -24,7 +24,7 @@ import java.io.Serializable;
|
|||
* @author Rod Johnson
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class TrueClassFilter implements ClassFilter, Serializable {
|
||||
final class TrueClassFilter implements ClassFilter, Serializable {
|
||||
|
||||
public static final TrueClassFilter INSTANCE = new TrueClassFilter();
|
||||
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.lang.Nullable;
|
|||
* @author Rod Johnson
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class TrueMethodMatcher implements MethodMatcher, Serializable {
|
||||
final class TrueMethodMatcher implements MethodMatcher, Serializable {
|
||||
|
||||
public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher();
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -24,7 +24,7 @@ import java.io.Serializable;
|
|||
* @author Rod Johnson
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class TruePointcut implements Pointcut, Serializable {
|
||||
final class TruePointcut implements Pointcut, Serializable {
|
||||
|
||||
public static final TruePointcut INSTANCE = new TruePointcut();
|
||||
|
||||
|
|
|
@ -561,6 +561,19 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
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
|
||||
|
@ -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 final ShadowMatch primary;
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -42,7 +42,7 @@ import org.springframework.lang.Nullable;
|
|||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class InstantiationModelAwarePointcutAdvisorImpl
|
||||
final class InstantiationModelAwarePointcutAdvisorImpl
|
||||
implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation, Serializable {
|
||||
|
||||
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
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -29,7 +29,7 @@ import org.springframework.aop.framework.AopConfigException;
|
|||
@SuppressWarnings("serial")
|
||||
public class NotAnAtAspectException extends AopConfigException {
|
||||
|
||||
private Class<?> nonAspectClass;
|
||||
private final Class<?> nonAspectClass;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,13 +27,17 @@ import org.springframework.lang.Nullable;
|
|||
* @author Ramnivas Laddad
|
||||
* @since 2.5
|
||||
*/
|
||||
public class ProxyCreationContext {
|
||||
public final class ProxyCreationContext {
|
||||
|
||||
/** ThreadLocal holding the current proxied bean name during Advisor matching. */
|
||||
private static final ThreadLocal<String> currentProxiedBeanName =
|
||||
new NamedThreadLocal<>("Name of currently proxied bean");
|
||||
|
||||
|
||||
private ProxyCreationContext() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the name of the currently proxied bean instance.
|
||||
* @return the name of the bean, or {@code null} if none available
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.springframework.core.PriorityOrdered;
|
|||
* @author Juergen Hoeller
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ExposeInvocationInterceptor implements MethodInterceptor, PriorityOrdered, Serializable {
|
||||
public final class ExposeInvocationInterceptor implements MethodInterceptor, PriorityOrdered, Serializable {
|
||||
|
||||
/** Singleton instance of this class. */
|
||||
public static final ExposeInvocationInterceptor INSTANCE = new ExposeInvocationInterceptor();
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.springframework.util.ObjectUtils;
|
|||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class EmptyTargetSource implements TargetSource, Serializable {
|
||||
public final class EmptyTargetSource implements TargetSource, Serializable {
|
||||
|
||||
/** use serialVersionUID from Spring 1.2 for interoperability. */
|
||||
private static final long serialVersionUID = 3680494563553489691L;
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,7 +22,11 @@ package org.springframework.cache.aspectj;
|
|||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
class AnyThrow {
|
||||
final class AnyThrow {
|
||||
|
||||
private AnyThrow() {
|
||||
}
|
||||
|
||||
|
||||
static void throwUnchecked(Throwable e) {
|
||||
AnyThrow.<RuntimeException>throwAny(e);
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -31,13 +31,13 @@ import org.springframework.lang.Nullable;
|
|||
@SuppressWarnings("serial")
|
||||
public class BeanInstantiationException extends FatalBeanException {
|
||||
|
||||
private Class<?> beanClass;
|
||||
private final Class<?> beanClass;
|
||||
|
||||
@Nullable
|
||||
private Constructor<?> constructor;
|
||||
private final Constructor<?> constructor;
|
||||
|
||||
@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) {
|
||||
super("Failed to instantiate [" + beanClass.getName() + "]: " + msg, cause);
|
||||
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);
|
||||
this.beanClass = constructor.getDeclaringClass();
|
||||
this.constructor = constructor;
|
||||
this.constructingMethod = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,6 +87,7 @@ public class BeanInstantiationException extends FatalBeanException {
|
|||
public BeanInstantiationException(Method constructingMethod, String msg, @Nullable Throwable cause) {
|
||||
super("Failed to instantiate [" + constructingMethod.getReturnType().getName() + "]: " + msg, cause);
|
||||
this.beanClass = constructingMethod.getReturnType();
|
||||
this.constructor = null;
|
||||
this.constructingMethod = constructingMethod;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ import org.springframework.util.StringUtils;
|
|||
* @see #clearClassLoader(ClassLoader)
|
||||
* @see #forClass(Class)
|
||||
*/
|
||||
public class CachedIntrospectionResults {
|
||||
public final class CachedIntrospectionResults {
|
||||
|
||||
/**
|
||||
* System property that instructs Spring to use the {@link Introspector#IGNORE_ALL_BEANINFO}
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -28,9 +28,9 @@ import org.springframework.lang.Nullable;
|
|||
@SuppressWarnings("serial")
|
||||
public class InvalidPropertyException extends FatalBeanException {
|
||||
|
||||
private Class<?> beanClass;
|
||||
private final Class<?> beanClass;
|
||||
|
||||
private String propertyName;
|
||||
private final String propertyName;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private String[] possibleMatches;
|
||||
private final String[] possibleMatches;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
|
|||
super(beanClass, propertyName,
|
||||
"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?");
|
||||
this.possibleMatches = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,6 +53,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
|
|||
*/
|
||||
public NotWritablePropertyException(Class<?> beanClass, String propertyName, String 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) {
|
||||
super(beanClass, propertyName, msg, cause);
|
||||
this.possibleMatches = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@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) {
|
||||
super(msg, cause);
|
||||
this.propertyChangeEvent = null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.springframework.util.ObjectUtils;
|
|||
public class PropertyBatchUpdateException extends BeansException {
|
||||
|
||||
/** List of PropertyAccessException objects. */
|
||||
private PropertyAccessException[] propertyAccessExceptions;
|
||||
private final PropertyAccessException[] propertyAccessExceptions;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 Juergen Hoeller
|
||||
*/
|
||||
class PropertyDescriptorUtils {
|
||||
final class PropertyDescriptorUtils {
|
||||
|
||||
|
||||
private PropertyDescriptorUtils() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See {@link java.beans.FeatureDescriptor}.
|
||||
|
|
|
@ -517,7 +517,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
|||
* Holder for a registered custom editor with property name.
|
||||
* Keeps the PropertyEditor itself plus the type it was registered for.
|
||||
*/
|
||||
private static class CustomEditorHolder {
|
||||
private static final class CustomEditorHolder {
|
||||
|
||||
private final PropertyEditor propertyEditor;
|
||||
|
||||
|
|
|
@ -35,10 +35,10 @@ import org.springframework.lang.Nullable;
|
|||
public class BeanCreationException extends FatalBeanException {
|
||||
|
||||
@Nullable
|
||||
private String beanName;
|
||||
private final String beanName;
|
||||
|
||||
@Nullable
|
||||
private String resourceDescription;
|
||||
private final String resourceDescription;
|
||||
|
||||
@Nullable
|
||||
private List<Throwable> relatedCauses;
|
||||
|
@ -50,6 +50,8 @@ public class BeanCreationException extends FatalBeanException {
|
|||
*/
|
||||
public BeanCreationException(String msg) {
|
||||
super(msg);
|
||||
this.beanName = null;
|
||||
this.resourceDescription = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,6 +61,8 @@ public class BeanCreationException extends FatalBeanException {
|
|||
*/
|
||||
public BeanCreationException(String msg, Throwable 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) {
|
||||
super("Error creating bean with name '" + beanName + "': " + msg);
|
||||
this.beanName = beanName;
|
||||
this.resourceDescription = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,6 +99,7 @@ public class BeanCreationException extends FatalBeanException {
|
|||
(resourceDescription != null ? " defined in " + resourceDescription : "") + ": " + msg);
|
||||
this.resourceDescription = resourceDescription;
|
||||
this.beanName = beanName;
|
||||
this.relatedCauses = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private String resourceDescription;
|
||||
private final String resourceDescription;
|
||||
|
||||
@Nullable
|
||||
private String beanName;
|
||||
private final String beanName;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -43,6 +43,8 @@ public class BeanDefinitionStoreException extends FatalBeanException {
|
|||
*/
|
||||
public BeanDefinitionStoreException(String 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) {
|
||||
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) {
|
||||
super(msg);
|
||||
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) {
|
||||
super(msg, cause);
|
||||
this.resourceDescription = resourceDescription;
|
||||
this.beanName = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,13 +29,13 @@ import org.springframework.util.ClassUtils;
|
|||
public class BeanNotOfRequiredTypeException extends BeansException {
|
||||
|
||||
/** The name of the instance that was of the wrong type. */
|
||||
private String beanName;
|
||||
private final String beanName;
|
||||
|
||||
/** The required type. */
|
||||
private Class<?> requiredType;
|
||||
private final Class<?> requiredType;
|
||||
|
||||
/** The offending type. */
|
||||
private Class<?> actualType;
|
||||
private final Class<?> actualType;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private String resourceDescription;
|
||||
private final String resourceDescription;
|
||||
|
||||
@Nullable
|
||||
private String beanName;
|
||||
private final String beanName;
|
||||
|
||||
@Nullable
|
||||
private String beanClassName;
|
||||
private final String beanClassName;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private String beanName;
|
||||
private final String beanName;
|
||||
|
||||
@Nullable
|
||||
private ResolvableType resolvableType;
|
||||
private final ResolvableType resolvableType;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -49,6 +49,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
|
|||
public NoSuchBeanDefinitionException(String name) {
|
||||
super("No bean named '" + name + "' available");
|
||||
this.beanName = name;
|
||||
this.resolvableType = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,6 +60,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
|
|||
public NoSuchBeanDefinitionException(String name, String message) {
|
||||
super("No bean named '" + name + "' available: " + message);
|
||||
this.beanName = name;
|
||||
this.resolvableType = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,6 +87,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
|
|||
*/
|
||||
public NoSuchBeanDefinitionException(ResolvableType type) {
|
||||
super("No qualifying bean of type '" + type + "' available");
|
||||
this.beanName = null;
|
||||
this.resolvableType = type;
|
||||
}
|
||||
|
||||
|
@ -96,6 +99,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
|
|||
*/
|
||||
public NoSuchBeanDefinitionException(ResolvableType type, String message) {
|
||||
super("No qualifying bean of type '" + type + "' available: " + message);
|
||||
this.beanName = null;
|
||||
this.resolvableType = type;
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -33,10 +33,10 @@ import org.springframework.util.StringUtils;
|
|||
@SuppressWarnings("serial")
|
||||
public class NoUniqueBeanDefinitionException extends NoSuchBeanDefinitionException {
|
||||
|
||||
private int numberOfBeansFound;
|
||||
private final int numberOfBeansFound;
|
||||
|
||||
@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) {
|
||||
super(type, message);
|
||||
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)
|
||||
*/
|
||||
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));
|
||||
this.numberOfBeansFound = beanNamesFound.size();
|
||||
this.beanNamesFound = beanNamesFound;
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private InjectionPoint injectionPoint;
|
||||
private final InjectionPoint injectionPoint;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -49,6 +49,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
|
|||
super(resourceDescription, beanName,
|
||||
"Unsatisfied dependency expressed through bean property '" + propertyName + "'" +
|
||||
(StringUtils.hasLength(msg) ? ": " + msg : ""));
|
||||
this.injectionPoint = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -34,7 +34,7 @@ import org.springframework.util.ObjectUtils;
|
|||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
public class BeanDefinitionBuilder {
|
||||
public final class BeanDefinitionBuilder {
|
||||
|
||||
/**
|
||||
* Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}.
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -35,7 +35,7 @@ import org.springframework.util.StringUtils;
|
|||
* @see PropertiesBeanDefinitionReader
|
||||
* @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
|
||||
|
@ -44,6 +44,10 @@ public class BeanDefinitionReaderUtils {
|
|||
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,
|
||||
* eagerly loading the bean class if a ClassLoader has been specified.
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MailSendException extends MailException {
|
|||
private final transient Map<Object, Exception> failedMessages;
|
||||
|
||||
@Nullable
|
||||
private Exception[] messageExceptions;
|
||||
private final Exception[] messageExceptions;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -56,6 +56,7 @@ public class MailSendException extends MailException {
|
|||
public MailSendException(String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
this.failedMessages = new LinkedHashMap<>();
|
||||
this.messageExceptions = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.springframework.cache.config;
|
|||
* @author Juergen Hoeller
|
||||
* @since 4.1
|
||||
*/
|
||||
public class CacheManagementConfigUtils {
|
||||
public final class CacheManagementConfigUtils {
|
||||
|
||||
/**
|
||||
* The name of the cache advisor bean.
|
||||
|
@ -48,4 +48,8 @@ public class CacheManagementConfigUtils {
|
|||
public static final String JCACHE_ASPECT_BEAN_NAME =
|
||||
"org.springframework.cache.config.internalJCacheAspect";
|
||||
|
||||
|
||||
private CacheManagementConfigUtils() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.springframework.util.ClassUtils;
|
|||
* @see org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor
|
||||
* @see org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
|
||||
*/
|
||||
public class AnnotationConfigUtils {
|
||||
public final class AnnotationConfigUtils {
|
||||
|
||||
/**
|
||||
* 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());
|
||||
|
||||
|
||||
private AnnotationConfigUtils() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register all relevant annotation post processors in the given registry.
|
||||
* @param registry the registry to operate on
|
||||
|
|
|
@ -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");
|
||||
* 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
|
||||
* @since 3.1
|
||||
*/
|
||||
class BeanAnnotationHelper {
|
||||
final class BeanAnnotationHelper {
|
||||
|
||||
|
||||
private BeanAnnotationHelper() {
|
||||
}
|
||||
|
||||
|
||||
public static boolean isBeanAnnotated(Method method) {
|
||||
return AnnotatedElementUtils.hasAnnotation(method, Bean.class);
|
||||
|
|
|
@ -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");
|
||||
* 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
|
||||
* @see org.springframework.aop.scope.ScopedProxyUtils#createScopedProxy
|
||||
*/
|
||||
class ScopedProxyCreator {
|
||||
final class ScopedProxyCreator {
|
||||
|
||||
|
||||
private ScopedProxyCreator() {
|
||||
}
|
||||
|
||||
|
||||
public static BeanDefinitionHolder createScopedProxy(
|
||||
BeanDefinitionHolder definitionHolder, BeanDefinitionRegistry registry, boolean proxyTargetClass) {
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -39,7 +39,7 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
|||
* @author Stephane Nicoll
|
||||
* @since 5.0
|
||||
*/
|
||||
public class CandidateComponentsIndexLoader {
|
||||
public final class CandidateComponentsIndexLoader {
|
||||
|
||||
/**
|
||||
* The location to look for components.
|
||||
|
@ -67,6 +67,10 @@ public class CandidateComponentsIndexLoader {
|
|||
new ConcurrentReferenceHashMap<>();
|
||||
|
||||
|
||||
private CandidateComponentsIndexLoader() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load and instantiate the {@link CandidateComponentsIndex} from
|
||||
* {@value #COMPONENTS_RESOURCE_LOCATION}, using the given class loader. If no
|
||||
|
|
|
@ -48,7 +48,12 @@ import org.springframework.lang.Nullable;
|
|||
* @author Juergen Hoeller
|
||||
* @since 4.0
|
||||
*/
|
||||
class PostProcessorRegistrationDelegate {
|
||||
final class PostProcessorRegistrationDelegate {
|
||||
|
||||
|
||||
private PostProcessorRegistrationDelegate() {
|
||||
}
|
||||
|
||||
|
||||
public static void invokeBeanFactoryPostProcessors(
|
||||
ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) {
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -38,6 +38,10 @@ public final class JodaTimeContextHolder {
|
|||
new NamedThreadLocal<>("JodaTimeContext");
|
||||
|
||||
|
||||
private JodaTimeContextHolder() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the JodaTimeContext for the current thread.
|
||||
*/
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
|
||||
private JodaTimeConverters() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Install the converters into the converter registry.
|
||||
* @param registry the converter registry
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -35,6 +35,10 @@ public final class DateTimeContextHolder {
|
|||
new NamedThreadLocal<>("DateTimeContext");
|
||||
|
||||
|
||||
private DateTimeContextHolder() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the DateTimeContext for the current thread.
|
||||
*/
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
|
||||
private DateTimeConverters() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Install the converters into the converter registry.
|
||||
* @param registry the converter registry
|
||||
|
|
|
@ -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.
|
||||
|
@ -28,7 +28,12 @@ import javax.management.ObjectName;
|
|||
* @since 1.2
|
||||
* @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.
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,7 +22,7 @@ package org.springframework.scheduling.config;
|
|||
* @author Juergen Hoeller
|
||||
* @since 4.1
|
||||
*/
|
||||
public class TaskManagementConfigUtils {
|
||||
public final class TaskManagementConfigUtils {
|
||||
|
||||
/**
|
||||
* 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 =
|
||||
"org.springframework.scheduling.config.internalAsyncExecutionAspect";
|
||||
|
||||
|
||||
private TaskManagementConfigUtils() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private ScriptSource scriptSource;
|
||||
private final ScriptSource scriptSource;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
|
|||
*/
|
||||
public ScriptCompilationException(String msg) {
|
||||
super(msg);
|
||||
this.scriptSource = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,6 +48,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
|
|||
*/
|
||||
public ScriptCompilationException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
this.scriptSource = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public static class BshExecutionException extends NestedRuntimeException {
|
||||
public static final class BshExecutionException extends NestedRuntimeException {
|
||||
|
||||
private BshExecutionException(EvalError ex) {
|
||||
super("BeanShell script execution failed", ex);
|
||||
|
|
|
@ -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));
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
|
|||
public class ExpressionException extends RuntimeException {
|
||||
|
||||
@Nullable
|
||||
protected String expressionString;
|
||||
protected final String expressionString;
|
||||
|
||||
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) {
|
||||
super(message);
|
||||
this.expressionString = null;
|
||||
this.position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,6 +51,8 @@ public class ExpressionException extends RuntimeException {
|
|||
*/
|
||||
public ExpressionException(String message, Throwable 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) {
|
||||
super(message);
|
||||
this.expressionString = null;
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
|
@ -92,6 +97,7 @@ public class ExpressionException extends RuntimeException {
|
|||
*/
|
||||
public ExpressionException(int position, String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.expressionString = null;
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -1029,19 +1044,5 @@ public class CodeFlow implements Opcodes {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.springframework.util.ObjectUtils;
|
|||
public abstract class Operator extends SpelNodeImpl {
|
||||
|
||||
private final String operatorName;
|
||||
|
||||
|
||||
// The descriptors of the runtime operand values are used if the discovered declared
|
||||
// descriptors are not providing enough information (for example a generic type
|
||||
// whose accessors seem to only be returning 'Object' - the actual descriptors may
|
||||
|
@ -104,8 +104,8 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
return (dc.areNumbers && dc.areCompatible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Numeric comparison operators share very similar generated code, only differing in
|
||||
/**
|
||||
* Numeric comparison operators share very similar generated code, only differing in
|
||||
* two comparison instructions.
|
||||
*/
|
||||
protected void generateComparisonCode(MethodVisitor mv, CodeFlow cf, int compInstruction1, int compInstruction2) {
|
||||
|
@ -113,20 +113,20 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
SpelNodeImpl right = getRightOperand();
|
||||
String leftDesc = left.exitTypeDescriptor;
|
||||
String rightDesc = right.exitTypeDescriptor;
|
||||
|
||||
|
||||
boolean unboxLeft = !CodeFlow.isPrimitive(leftDesc);
|
||||
boolean unboxRight = !CodeFlow.isPrimitive(rightDesc);
|
||||
DescriptorComparison dc = DescriptorComparison.checkNumericCompatibility(
|
||||
leftDesc, rightDesc, this.leftActualDescriptor, this.rightActualDescriptor);
|
||||
char targetType = dc.compatibleType; // CodeFlow.toPrimitiveTargetDesc(leftDesc);
|
||||
|
||||
|
||||
cf.enterCompilationScope();
|
||||
left.generateCode(mv, cf);
|
||||
cf.exitCompilationScope();
|
||||
if (unboxLeft) {
|
||||
CodeFlow.insertUnboxInsns(mv, targetType, leftDesc);
|
||||
}
|
||||
|
||||
|
||||
cf.enterCompilationScope();
|
||||
right.generateCode(mv, cf);
|
||||
cf.exitCompilationScope();
|
||||
|
@ -142,11 +142,11 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
mv.visitJumpInsn(compInstruction1, elseTarget);
|
||||
}
|
||||
else if (targetType == 'F') {
|
||||
mv.visitInsn(FCMPG);
|
||||
mv.visitInsn(FCMPG);
|
||||
mv.visitJumpInsn(compInstruction1, elseTarget);
|
||||
}
|
||||
else if (targetType == 'J') {
|
||||
mv.visitInsn(LCMP);
|
||||
mv.visitInsn(LCMP);
|
||||
mv.visitJumpInsn(compInstruction1, elseTarget);
|
||||
}
|
||||
else if (targetType == 'I') {
|
||||
|
@ -231,13 +231,13 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A descriptor comparison encapsulates the result of comparing descriptor
|
||||
* 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, ' ');
|
||||
|
||||
|
@ -254,7 +254,7 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
this.areCompatible = areCompatible;
|
||||
this.compatibleType = compatibleType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an object that indicates whether the input descriptors are compatible.
|
||||
* <p>A declared descriptor is what could statically be determined (e.g. from looking
|
||||
|
@ -278,7 +278,7 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
|
||||
boolean leftNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(ld);
|
||||
boolean rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
|
||||
|
||||
|
||||
// If the declared descriptors aren't providing the information, try the actual descriptors
|
||||
if (!leftNumeric && !ObjectUtils.nullSafeEquals(ld, leftActualDescriptor)) {
|
||||
ld = leftActualDescriptor;
|
||||
|
@ -288,7 +288,7 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
rd = rightActualDescriptor;
|
||||
rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
|
||||
}
|
||||
|
||||
|
||||
if (leftNumeric && rightNumeric) {
|
||||
if (CodeFlow.areBoxingCompatible(ld, rd)) {
|
||||
return new DescriptorComparison(true, true, CodeFlow.toPrimitiveTargetDesc(ld));
|
||||
|
@ -299,7 +299,7 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
}
|
||||
else {
|
||||
return DescriptorComparison.NOT_NUMBERS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -64,7 +64,7 @@ import org.springframework.util.ReflectionUtils;
|
|||
* @author Andy Clement
|
||||
* @since 4.1
|
||||
*/
|
||||
public class SpelCompiler implements Opcodes {
|
||||
public final class SpelCompiler implements Opcodes {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(SpelCompiler.class);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.springframework.expression.TypedValue;
|
|||
* @author Andy Clement
|
||||
* @since 3.0
|
||||
*/
|
||||
public class BooleanTypedValue extends TypedValue {
|
||||
public final class BooleanTypedValue extends TypedValue {
|
||||
|
||||
/**
|
||||
* True.
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.springframework.lang.Nullable;
|
|||
* @see #forInstanceMethodInvocation()
|
||||
* @see DataBindingPropertyAccessor
|
||||
*/
|
||||
public class DataBindingMethodResolver extends ReflectiveMethodResolver {
|
||||
public final class DataBindingMethodResolver extends ReflectiveMethodResolver {
|
||||
|
||||
private DataBindingMethodResolver() {
|
||||
super();
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.lang.reflect.Method;
|
|||
* @see StandardEvaluationContext
|
||||
* @see ReflectivePropertyAccessor
|
||||
*/
|
||||
public class DataBindingPropertyAccessor extends ReflectivePropertyAccessor {
|
||||
public final class DataBindingPropertyAccessor extends ReflectivePropertyAccessor {
|
||||
|
||||
/**
|
||||
* Create a new property accessor for reading and possibly also writing.
|
||||
|
|
|
@ -86,7 +86,7 @@ import org.springframework.lang.Nullable;
|
|||
* @see StandardTypeConverter
|
||||
* @see DataBindingPropertyAccessor
|
||||
*/
|
||||
public class SimpleEvaluationContext implements EvaluationContext {
|
||||
public final class SimpleEvaluationContext implements EvaluationContext {
|
||||
|
||||
private static final TypeLocator typeNotFoundTypeLocator = typeName -> {
|
||||
throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName);
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,11 +27,15 @@ import java.lang.instrument.Instrumentation;
|
|||
* @since 2.0
|
||||
* @see org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
|
||||
*/
|
||||
public class InstrumentationSavingAgent {
|
||||
public final class InstrumentationSavingAgent {
|
||||
|
||||
private static volatile Instrumentation instrumentation;
|
||||
|
||||
|
||||
private InstrumentationSavingAgent() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save the {@link Instrumentation} interface exposed by the JVM.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
@ -34,7 +34,7 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
|||
@SuppressWarnings("serial")
|
||||
public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException {
|
||||
|
||||
private String sql;
|
||||
private final String sql;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
@ -29,9 +29,9 @@ import org.springframework.dao.DataRetrievalFailureException;
|
|||
@SuppressWarnings("serial")
|
||||
public class IncorrectResultSetColumnCountException extends DataRetrievalFailureException {
|
||||
|
||||
private int expectedCount;
|
||||
private final int expectedCount;
|
||||
|
||||
private int actualCount;
|
||||
private final int actualCount;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private String sql;
|
||||
private final String sql;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -57,6 +57,7 @@ public class InvalidResultSetAccessException extends InvalidDataAccessResourceUs
|
|||
*/
|
||||
public InvalidResultSetAccessException(SQLException ex) {
|
||||
super(ex.getMessage(), ex);
|
||||
this.sql = null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ import org.springframework.dao.IncorrectUpdateSemanticsDataAccessException;
|
|||
public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectUpdateSemanticsDataAccessException {
|
||||
|
||||
/** Number of rows that should have been affected. */
|
||||
private int expected;
|
||||
private final int expected;
|
||||
|
||||
/** Number of rows that actually were affected. */
|
||||
private int actual;
|
||||
private final int actual;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,12 @@ import org.springframework.util.xml.DomUtils;
|
|||
* @author Stephane Nicoll
|
||||
* @since 3.1
|
||||
*/
|
||||
class DatabasePopulatorConfigUtils {
|
||||
final class DatabasePopulatorConfigUtils {
|
||||
|
||||
|
||||
private DatabasePopulatorConfigUtils() {
|
||||
}
|
||||
|
||||
|
||||
public static void setDatabasePopulator(Element element, BeanDefinitionBuilder builder) {
|
||||
List<Element> scripts = DomUtils.getChildElementsByTagName(element, "script");
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.springframework.jdbc.support.MetaDataAccessException;
|
|||
* @author Juergen Hoeller
|
||||
* @since 2.5
|
||||
*/
|
||||
public class CallMetaDataProviderFactory {
|
||||
public final class CallMetaDataProviderFactory {
|
||||
|
||||
/** List of supported database products for procedure calls. */
|
||||
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 CallMetaDataProviderFactory() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a {@link CallMetaDataProvider} based on the database meta-data.
|
||||
* @param dataSource the JDBC DataSource to use for retrieving meta-data
|
||||
|
|
|
@ -32,11 +32,15 @@ import org.springframework.jdbc.support.MetaDataAccessException;
|
|||
* @author Thomas Risberg
|
||||
* @since 2.5
|
||||
*/
|
||||
public class TableMetaDataProviderFactory {
|
||||
public final class TableMetaDataProviderFactory {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TableMetaDataProviderFactory.class);
|
||||
|
||||
|
||||
private TableMetaDataProviderFactory() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a {@link TableMetaDataProvider} based on the database meta-data.
|
||||
* @param dataSource used to retrieve meta-data
|
||||
|
|
|
@ -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");
|
||||
* 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.
|
||||
*/
|
||||
private static class JdbcUserCredentials {
|
||||
private static final class JdbcUserCredentials {
|
||||
|
||||
public final String username;
|
||||
|
||||
|
|
|
@ -29,6 +29,11 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
final class EmbeddedDatabaseConfigurerFactory {
|
||||
|
||||
|
||||
private EmbeddedDatabaseConfigurerFactory() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a configurer instance for the given embedded database type.
|
||||
* @param type the embedded database type (HSQL, H2 or Derby)
|
||||
|
|
|
@ -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.
|
||||
|
@ -26,7 +26,12 @@ import java.io.OutputStream;
|
|||
* @author Juergen Hoeller
|
||||
* @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.
|
||||
|
|
|
@ -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");
|
||||
* 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
|
||||
* @see SQLErrorCodesFactory
|
||||
*/
|
||||
public class CustomSQLExceptionTranslatorRegistry {
|
||||
public final class CustomSQLExceptionTranslatorRegistry {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(CustomSQLExceptionTranslatorRegistry.class);
|
||||
|
||||
|
|
|
@ -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");
|
||||
* 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.
|
||||
*/
|
||||
private static class JmsUserCredentials {
|
||||
private static final class JmsUserCredentials {
|
||||
|
||||
public final String username;
|
||||
|
||||
public final String password;
|
||||
|
||||
|
||||
private JmsUserCredentials(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JmsUserCredentials[username='" + this.username + "',password='" + this.password + "']";
|
||||
|
|
|
@ -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) {
|
||||
super(annotation.value(), true, ValueConstants.DEFAULT_NONE);
|
||||
|
|
|
@ -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");
|
||||
* 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) {
|
||||
super(annotation.name(), annotation.required(), annotation.defaultValue());
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -34,7 +34,7 @@ import org.springframework.validation.ObjectError;
|
|||
@SuppressWarnings("serial")
|
||||
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) {
|
||||
super(message, parameter);
|
||||
this.bindingResult = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -577,7 +577,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
|
|||
private volatile boolean isStompConnected;
|
||||
|
||||
|
||||
private StompConnectionHandler(String sessionId, StompHeaderAccessor connectHeaders) {
|
||||
protected StompConnectionHandler(String sessionId, StompHeaderAccessor connectHeaders) {
|
||||
this(sessionId, connectHeaders, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private Object persistentClass;
|
||||
private final Object persistentClass;
|
||||
|
||||
@Nullable
|
||||
private Object identifier;
|
||||
private final Object identifier;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,8 @@ public class ObjectOptimisticLockingFailureException extends OptimisticLockingFa
|
|||
*/
|
||||
public ObjectOptimisticLockingFailureException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
this.persistentClass = null;
|
||||
this.identifier = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
* 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 {
|
||||
|
||||
@Nullable
|
||||
private Object persistentClass;
|
||||
private final Object persistentClass;
|
||||
|
||||
@Nullable
|
||||
private Object identifier;
|
||||
private final Object identifier;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,8 @@ public class ObjectRetrievalFailureException extends DataRetrievalFailureExcepti
|
|||
*/
|
||||
public ObjectRetrievalFailureException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
this.persistentClass = null;
|
||||
this.identifier = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -890,7 +890,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
|||
* Holder for suspended resources.
|
||||
* Used internally by {@code doSuspend} and {@code doResume}.
|
||||
*/
|
||||
private static class SuspendedResourcesHolder {
|
||||
private static final class SuspendedResourcesHolder {
|
||||
|
||||
private final SessionHolder sessionHolder;
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ public abstract class ExtendedEntityManagerCreator {
|
|||
* InvocationHandler for extended EntityManagers as defined in the JPA spec.
|
||||
*/
|
||||
@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);
|
||||
|
||||
|
|
|
@ -745,7 +745,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
|||
* Holder for suspended resources.
|
||||
* Used internally by {@code doSuspend} and {@code doResume}.
|
||||
*/
|
||||
private static class SuspendedResourcesHolder {
|
||||
private static final class SuspendedResourcesHolder {
|
||||
|
||||
private final EntityManagerHolder entityManagerHolder;
|
||||
|
||||
|
|
|
@ -127,6 +127,9 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||
|
||||
private static final String CID = "cid:";
|
||||
|
||||
private static final EntityResolver NO_OP_ENTITY_RESOLVER =
|
||||
(publicId, systemId) -> new InputSource(new StringReader(""));
|
||||
|
||||
|
||||
/** Logger available to subclasses. */
|
||||
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(""));
|
||||
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
*/
|
||||
public class MockServerHttpRequest extends AbstractServerHttpRequest {
|
||||
public final class MockServerHttpRequest extends AbstractServerHttpRequest {
|
||||
|
||||
private final HttpMethod httpMethod;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
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 {
|
||||
super(context, root);
|
||||
|
|
|
@ -150,7 +150,7 @@ public class MockFilterChain implements FilterChain {
|
|||
/**
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
* @author Arjen Poutsma
|
||||
* @since 5.0
|
||||
*/
|
||||
public class MockServerRequest implements ServerRequest {
|
||||
public final class MockServerRequest implements ServerRequest {
|
||||
|
||||
private final HttpMethod method;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -26,7 +26,7 @@ import org.springframework.util.Assert;
|
|||
* @author Sam Brannen
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SystemProfileValueSource implements ProfileValueSource {
|
||||
public final class SystemProfileValueSource implements ProfileValueSource {
|
||||
|
||||
private static final SystemProfileValueSource INSTANCE = new SystemProfileValueSource();
|
||||
|
||||
|
|
|
@ -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");
|
||||
* 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
|
||||
* @since 4.2
|
||||
*/
|
||||
public class TestAnnotationUtils {
|
||||
public final class TestAnnotationUtils {
|
||||
|
||||
|
||||
private TestAnnotationUtils() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the {@code timeout} configured via the {@link Timed @Timed}
|
||||
|
|
|
@ -38,7 +38,12 @@ import org.springframework.util.Assert;
|
|||
* @since 4.1
|
||||
* @see TransactionalTestExecutionListener
|
||||
*/
|
||||
public class TestTransaction {
|
||||
public final class TestTransaction {
|
||||
|
||||
|
||||
private TestTransaction() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a test-managed transaction is currently <em>active</em>.
|
||||
|
|
|
@ -25,12 +25,16 @@ import org.springframework.lang.Nullable;
|
|||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
*/
|
||||
class TransactionContextHolder {
|
||||
final class TransactionContextHolder {
|
||||
|
||||
private static final ThreadLocal<TransactionContext> currentTransactionContext =
|
||||
new NamedInheritableThreadLocal<>("Test Transaction Context");
|
||||
|
||||
|
||||
private TransactionContextHolder() {
|
||||
}
|
||||
|
||||
|
||||
static void setCurrentTransactionContext(TransactionContext transactionContext) {
|
||||
currentTransactionContext.set(transactionContext);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
* 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.DatabasePopulatorUtils
|
||||
*/
|
||||
public class JdbcTestUtils {
|
||||
public final class JdbcTestUtils {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(JdbcTestUtils.class);
|
||||
|
||||
|
||||
private JdbcTestUtils() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count the rows in the given table.
|
||||
* @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -38,7 +38,7 @@ import org.springframework.util.Assert;
|
|||
* @author Rossen Stoyanchev
|
||||
* @since 4.3
|
||||
*/
|
||||
public class ExpectedCount {
|
||||
public final class ExpectedCount {
|
||||
|
||||
private final int minCount;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ import org.springframework.web.client.support.RestGatewaySupport;
|
|||
* @since 3.2
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class MockRestServiceServer {
|
||||
public final class MockRestServiceServer {
|
||||
|
||||
private final RequestExpectationManager expectationManager;
|
||||
|
||||
|
|
|
@ -33,7 +33,12 @@ import org.springframework.web.context.WebApplicationContext;
|
|||
* @see #webAppContextSetup(WebApplicationContext)
|
||||
* @see #standaloneSetup(Object...)
|
||||
*/
|
||||
public class MockMvcBuilders {
|
||||
public final class MockMvcBuilders {
|
||||
|
||||
|
||||
private MockMvcBuilders() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a {@link MockMvc} instance using the given, fully initialized
|
||||
|
|
|
@ -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.
|
||||
|
@ -28,9 +28,9 @@ package org.springframework.dao;
|
|||
@SuppressWarnings("serial")
|
||||
public class IncorrectResultSizeDataAccessException extends DataRetrievalFailureException {
|
||||
|
||||
private int expectedSize;
|
||||
private final int expectedSize;
|
||||
|
||||
private int actualSize;
|
||||
private final int actualSize;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -225,7 +225,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
|
|||
/**
|
||||
* 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;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class HeuristicCompletionException extends TransactionException {
|
|||
/**
|
||||
* The outcome state of the transaction: have some or all resources been committed?
|
||||
*/
|
||||
private int outcomeState = STATE_UNKNOWN;
|
||||
private final int outcomeState;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
@ -27,7 +27,7 @@ package org.springframework.transaction;
|
|||
@SuppressWarnings("serial")
|
||||
public class InvalidTimeoutException extends TransactionUsageException {
|
||||
|
||||
private int timeout;
|
||||
private final int timeout;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1273,7 +1273,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
|
|||
* Holder for suspended resources.
|
||||
* Used internally by {@code suspend} and {@code resume}.
|
||||
*/
|
||||
protected static class SuspendedResourcesHolder {
|
||||
protected static final class SuspendedResourcesHolder {
|
||||
|
||||
@Nullable
|
||||
private final Object suspendedResources;
|
||||
|
|
|
@ -39,7 +39,7 @@ import static java.time.format.DateTimeFormatter.*;
|
|||
* @since 5.0
|
||||
* @see <a href="https://tools.ietf.org/html/rfc2183">RFC 2183</a>
|
||||
*/
|
||||
public class ContentDisposition {
|
||||
public final class ContentDisposition {
|
||||
|
||||
@Nullable
|
||||
private final String type;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue