Use consistent class design
Update all classes so that inner classes are always last. Also ensure that utility classes are always final and have a private constructor and make exceptions final whenever possible. Issue: SPR-16968
This commit is contained in:
committed by
Juergen Hoeller
parent
0ad0f341bd
commit
eeebd51f57
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user