Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing generics or deprecated code. Also add the `-Werror` compiler option to ensure that any future warnings will fail the build. Issue: SPR-11064
This commit is contained in:
parent
4de3291dc7
commit
59002f2456
32
build.gradle
32
build.gradle
|
|
@ -26,27 +26,21 @@ configure(allprojects) { project ->
|
|||
apply plugin: "test-source-set-dependencies"
|
||||
apply from: "${gradleScriptDir}/ide.gradle"
|
||||
|
||||
[compileJava, compileTestJava]*.options*.compilerArgs = [
|
||||
"-Xlint:serial",
|
||||
"-Xlint:varargs",
|
||||
"-Xlint:cast",
|
||||
"-Xlint:classfile",
|
||||
"-Xlint:dep-ann",
|
||||
"-Xlint:divzero",
|
||||
"-Xlint:empty",
|
||||
"-Xlint:finally",
|
||||
"-Xlint:overrides",
|
||||
"-Xlint:path",
|
||||
"-Xlint:processing",
|
||||
"-Xlint:static",
|
||||
"-Xlint:try",
|
||||
"-Xlint:-options", // intentionally disabled
|
||||
"-Xlint:-fallthrough", // intentionally disabled
|
||||
"-Xlint:-rawtypes", // TODO enable and fix warnings
|
||||
"-Xlint:-deprecation", // TODO enable and fix warnings
|
||||
"-Xlint:-unchecked" // TODO enable and fix warnings
|
||||
compileJava.options*.compilerArgs = [
|
||||
"-Xlint:serial", "-Xlint:varargs", "-Xlint:cast", "-Xlint:classfile",
|
||||
"-Xlint:dep-ann", "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally",
|
||||
"-Xlint:overrides", "-Xlint:path", "-Xlint:processing", "-Xlint:static",
|
||||
"-Xlint:try", "-Xlint:fallthrough", "-Xlint:rawtypes", "-Xlint:deprecation",
|
||||
"-Xlint:unchecked", "-Xlint:-options", "-Werror"
|
||||
]
|
||||
|
||||
compileTestJava.options*.compilerArgs = [
|
||||
"-Xlint:serial", "-Xlint:varargs", "-Xlint:cast", "-Xlint:classfile",
|
||||
"-Xlint:dep-ann", "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally",
|
||||
"-Xlint:overrides", "-Xlint:path", "-Xlint:processing", "-Xlint:static",
|
||||
"-Xlint:try", "-Xlint:-fallthrough", "-Xlint:-rawtypes", "-Xlint:-deprecation",
|
||||
"-Xlint:-unchecked", "-Xlint:-options"]
|
||||
|
||||
compileJava {
|
||||
sourceCompatibility=1.6
|
||||
targetCompatibility=1.6
|
||||
|
|
|
|||
|
|
@ -39,6 +39,6 @@ public interface IntroductionAwareMethodMatcher extends MethodMatcher {
|
|||
* asking is the subject on one or more introductions; {@code false} otherwise
|
||||
* @return whether or not this method matches statically
|
||||
*/
|
||||
boolean matches(Method method, Class targetClass, boolean hasIntroductions);
|
||||
boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ public interface IntroductionInfo {
|
|||
* Return the additional interfaces introduced by this Advisor or Advice.
|
||||
* @return the introduced interfaces
|
||||
*/
|
||||
Class[] getInterfaces();
|
||||
Class<?>[] getInterfaces();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class TrueClassFilter implements ClassFilter, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ class TrueMethodMatcher implements MethodMatcher, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, Object[] args) {
|
||||
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
|
||||
// Should never be invoked as isRuntime returns false.
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
/** Non-null if after returning advice binds the return value */
|
||||
private String returningName = null;
|
||||
|
||||
private Class discoveredReturningType = Object.class;
|
||||
private Class<?> discoveredReturningType = Object.class;
|
||||
|
||||
private Class discoveredThrowingType = Object.class;
|
||||
private Class<?> discoveredThrowingType = Object.class;
|
||||
|
||||
/**
|
||||
* Index for thisJoinPoint argument (currently only
|
||||
|
|
@ -253,7 +253,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
if (argumentNames != null) {
|
||||
if (aspectJAdviceMethod.getParameterTypes().length == argumentNames.length + 1) {
|
||||
// May need to add implicit join point arg name...
|
||||
Class firstArgType = aspectJAdviceMethod.getParameterTypes()[0];
|
||||
Class<?> firstArgType = aspectJAdviceMethod.getParameterTypes()[0];
|
||||
if (firstArgType == JoinPoint.class ||
|
||||
firstArgType == ProceedingJoinPoint.class ||
|
||||
firstArgType == JoinPoint.StaticPart.class) {
|
||||
|
|
@ -292,7 +292,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
}
|
||||
}
|
||||
|
||||
protected Class getDiscoveredReturningType() {
|
||||
protected Class<?> getDiscoveredReturningType() {
|
||||
return this.discoveredReturningType;
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
}
|
||||
}
|
||||
|
||||
protected Class getDiscoveredThrowingType() {
|
||||
protected Class<?> getDiscoveredThrowingType() {
|
||||
return this.discoveredThrowingType;
|
||||
}
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
}
|
||||
|
||||
int numUnboundArgs = this.adviceInvocationArgumentCount;
|
||||
Class[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes();
|
||||
Class<?>[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes();
|
||||
if (maybeBindJoinPoint(parameterTypes[0]) || maybeBindProceedingJoinPoint(parameterTypes[0])) {
|
||||
numUnboundArgs--;
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
this.argumentsIntrospected = true;
|
||||
}
|
||||
|
||||
private boolean maybeBindJoinPoint(Class candidateParameterType) {
|
||||
private boolean maybeBindJoinPoint(Class<?> candidateParameterType) {
|
||||
if (candidateParameterType.equals(JoinPoint.class)) {
|
||||
this.joinPointArgumentIndex = 0;
|
||||
return true;
|
||||
|
|
@ -390,7 +390,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
}
|
||||
}
|
||||
|
||||
private boolean maybeBindProceedingJoinPoint(Class candidateParameterType) {
|
||||
private boolean maybeBindProceedingJoinPoint(Class<?> candidateParameterType) {
|
||||
if (candidateParameterType.equals(ProceedingJoinPoint.class)) {
|
||||
if (!supportsProceedingJoinPoint()) {
|
||||
throw new IllegalArgumentException("ProceedingJoinPoint is only supported for around advice");
|
||||
|
|
@ -407,7 +407,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean maybeBindJoinPointStaticPart(Class candidateParameterType) {
|
||||
private boolean maybeBindJoinPointStaticPart(Class<?> candidateParameterType) {
|
||||
if (candidateParameterType.equals(JoinPoint.StaticPart.class)) {
|
||||
this.joinPointStaticPartArgumentIndex = 0;
|
||||
return true;
|
||||
|
|
@ -509,8 +509,8 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
numParametersToRemove++;
|
||||
}
|
||||
String[] pointcutParameterNames = new String[this.argumentNames.length - numParametersToRemove];
|
||||
Class[] pointcutParameterTypes = new Class[pointcutParameterNames.length];
|
||||
Class[] methodParameterTypes = this.aspectJAdviceMethod.getParameterTypes();
|
||||
Class<?>[] pointcutParameterTypes = new Class<?>[pointcutParameterNames.length];
|
||||
Class<?>[] methodParameterTypes = this.aspectJAdviceMethod.getParameterTypes();
|
||||
|
||||
int index = 0;
|
||||
for (int i = 0; i < this.argumentNames.length; i++) {
|
||||
|
|
@ -679,7 +679,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return !this.adviceMethod.equals(method);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import java.lang.reflect.Constructor;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -29,7 +28,6 @@ import org.aspectj.lang.JoinPoint;
|
|||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.weaver.tools.PointcutParser;
|
||||
import org.aspectj.weaver.tools.PointcutPrimitive;
|
||||
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -142,9 +140,8 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
singleValuedAnnotationPcds.add("@withincode");
|
||||
singleValuedAnnotationPcds.add("@annotation");
|
||||
|
||||
Set pointcutPrimitives = PointcutParser.getAllSupportedPointcutPrimitives();
|
||||
for (Iterator iterator = pointcutPrimitives.iterator(); iterator.hasNext();) {
|
||||
PointcutPrimitive primitive = (PointcutPrimitive) iterator.next();
|
||||
Set<PointcutPrimitive> pointcutPrimitives = PointcutParser.getAllSupportedPointcutPrimitives();
|
||||
for (PointcutPrimitive primitive : pointcutPrimitives) {
|
||||
nonReferencePointcutTokens.add(primitive.getName());
|
||||
}
|
||||
nonReferencePointcutTokens.add("&&");
|
||||
|
|
@ -173,7 +170,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
*/
|
||||
private String pointcutExpression;
|
||||
|
||||
private Class[] argumentTypes;
|
||||
private Class<?>[] argumentTypes;
|
||||
|
||||
private String[] parameterNameBindings;
|
||||
|
||||
|
|
@ -311,7 +308,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
* {@link #setRaiseExceptions(boolean) raiseExceptions} has been set to {@code true}
|
||||
*/
|
||||
@Override
|
||||
public String[] getParameterNames(Constructor ctor) {
|
||||
public String[] getParameterNames(Constructor<?> ctor) {
|
||||
if (this.raiseExceptions) {
|
||||
throw new UnsupportedOperationException("An advice method can never be a constructor");
|
||||
}
|
||||
|
|
@ -731,7 +728,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
* Return {@code true} if the given argument type is a subclass
|
||||
* of the given supertype.
|
||||
*/
|
||||
private boolean isSubtypeOf(Class supertype, int argumentNumber) {
|
||||
private boolean isSubtypeOf(Class<?> supertype, int argumentNumber) {
|
||||
return supertype.isAssignableFrom(this.argumentTypes[argumentNumber]);
|
||||
}
|
||||
|
||||
|
|
@ -759,7 +756,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
* Find the argument index with the given type, and bind the given
|
||||
* {@code varName} in that position.
|
||||
*/
|
||||
private void findAndBind(Class argumentType, String varName) {
|
||||
private void findAndBind(Class<?> argumentType, String varName) {
|
||||
for (int i = 0; i < this.argumentTypes.length; i++) {
|
||||
if (isUnbound(i) && isSubtypeOf(argumentType, i)) {
|
||||
bindParameterName(i, varName);
|
||||
|
|
|
|||
|
|
@ -70,8 +70,7 @@ public class AspectJAfterThrowingAdvice extends AbstractAspectJAdvice implements
|
|||
* is only invoked if the thrown exception is a subtype of the given throwing type.
|
||||
*/
|
||||
private boolean shouldInvokeOnThrowing(Throwable t) {
|
||||
Class throwingType = getDiscoveredThrowingType();
|
||||
return throwingType.isAssignableFrom(t.getClass());
|
||||
return getDiscoveredThrowingType().isAssignableFrom(t.getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
|
||||
private static final Log logger = LogFactory.getLog(AspectJExpressionPointcut.class);
|
||||
|
||||
private Class pointcutDeclarationScope;
|
||||
private Class<?> pointcutDeclarationScope;
|
||||
|
||||
private String[] pointcutParameterNames = new String[0];
|
||||
|
||||
private Class[] pointcutParameterTypes = new Class[0];
|
||||
private Class<?>[] pointcutParameterTypes = new Class<?>[0];
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
* @param paramNames the parameter names for the pointcut
|
||||
* @param paramTypes the parameter types for the pointcut
|
||||
*/
|
||||
public AspectJExpressionPointcut(Class declarationScope, String[] paramNames, Class[] paramTypes) {
|
||||
public AspectJExpressionPointcut(Class<?> declarationScope, String[] paramNames, Class<?>[] paramTypes) {
|
||||
this.pointcutDeclarationScope = declarationScope;
|
||||
if (paramNames.length != paramTypes.length) {
|
||||
throw new IllegalStateException(
|
||||
|
|
@ -137,7 +137,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
/**
|
||||
* Set the declaration scope for the pointcut.
|
||||
*/
|
||||
public void setPointcutDeclarationScope(Class pointcutDeclarationScope) {
|
||||
public void setPointcutDeclarationScope(Class<?> pointcutDeclarationScope) {
|
||||
this.pointcutDeclarationScope = pointcutDeclarationScope;
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
/**
|
||||
* Set the parameter types for the pointcut.
|
||||
*/
|
||||
public void setParameterTypes(Class[] types) {
|
||||
public void setParameterTypes(Class<?>[] types) {
|
||||
this.pointcutParameterTypes = types;
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Class targetClass) {
|
||||
public boolean matches(Class<?> targetClass) {
|
||||
checkReadyToMatch();
|
||||
try {
|
||||
return this.pointcutExpression.couldMatchJoinPointsInType(targetClass);
|
||||
|
|
@ -272,7 +272,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, boolean beanHasIntroductions) {
|
||||
public boolean matches(Method method, Class<?> targetClass, boolean beanHasIntroductions) {
|
||||
checkReadyToMatch();
|
||||
Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
||||
ShadowMatch shadowMatch = getShadowMatch(targetMethod, method);
|
||||
|
|
@ -293,7 +293,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return matches(method, targetClass, false);
|
||||
}
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, Object[] args) {
|
||||
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
|
||||
checkReadyToMatch();
|
||||
ShadowMatch shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method);
|
||||
ShadowMatch originalShadowMatch = getShadowMatch(method, method);
|
||||
|
|
@ -377,7 +377,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
return !(getRuntimeTestWalker(shadowMatch).testsSubtypeSensitiveVars());
|
||||
}
|
||||
|
||||
private boolean matchesTarget(ShadowMatch shadowMatch, Class targetClass) {
|
||||
private boolean matchesTarget(ShadowMatch shadowMatch, Class<?> targetClass) {
|
||||
return getRuntimeTestWalker(shadowMatch).testTargetInstanceOfResidue(targetClass);
|
||||
}
|
||||
|
||||
|
|
@ -542,11 +542,15 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Deprecated
|
||||
public boolean couldMatchJoinPointsInType(Class someClass) {
|
||||
return (contextMatch(someClass) == FuzzyBoolean.YES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Deprecated
|
||||
public boolean couldMatchJoinPointsInType(Class someClass, MatchingContext context) {
|
||||
return (contextMatch(someClass) == FuzzyBoolean.YES);
|
||||
}
|
||||
|
|
@ -566,7 +570,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
return false;
|
||||
}
|
||||
|
||||
private FuzzyBoolean contextMatch(Class targetType) {
|
||||
private FuzzyBoolean contextMatch(Class<?> targetType) {
|
||||
String advisedBeanName = getCurrentProxiedBeanName();
|
||||
if (advisedBeanName == null) { // no proxy creation in progress
|
||||
// abstain; can't return YES, since that will make pointcut with negation fail
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv
|
|||
this.pointcut.setLocation(location);
|
||||
}
|
||||
|
||||
public void setParameterTypes(Class[] types) {
|
||||
public void setParameterTypes(Class<?>[] types) {
|
||||
this.pointcut.setParameterTypes(types);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
|||
*/
|
||||
public class DeclareParentsAdvisor implements IntroductionAdvisor {
|
||||
|
||||
private final Class introducedInterface;
|
||||
private final Class<?> introducedInterface;
|
||||
|
||||
private final ClassFilter typePatternClassFilter;
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
|
|||
* @param typePattern type pattern the introduction is restricted to
|
||||
* @param defaultImpl the default implementation class
|
||||
*/
|
||||
public DeclareParentsAdvisor(Class interfaceType, String typePattern, Class defaultImpl) {
|
||||
public DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Class<?> defaultImpl) {
|
||||
this(interfaceType, typePattern, defaultImpl,
|
||||
new DelegatePerTargetObjectIntroductionInterceptor(defaultImpl, interfaceType));
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
|
|||
* @param typePattern type pattern the introduction is restricted to
|
||||
* @param delegateRef the delegate implementation object
|
||||
*/
|
||||
public DeclareParentsAdvisor(Class interfaceType, String typePattern, Object delegateRef) {
|
||||
public DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Object delegateRef) {
|
||||
this(interfaceType, typePattern, delegateRef.getClass(),
|
||||
new DelegatingIntroductionInterceptor(delegateRef));
|
||||
}
|
||||
|
|
@ -71,14 +71,14 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
|
|||
* @param implementationClass implementation class
|
||||
* @param advice delegation advice
|
||||
*/
|
||||
private DeclareParentsAdvisor(Class interfaceType, String typePattern, Class implementationClass, Advice advice) {
|
||||
private DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Class<?> implementationClass, Advice advice) {
|
||||
this.introducedInterface = interfaceType;
|
||||
ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern);
|
||||
|
||||
// Excludes methods implemented.
|
||||
ClassFilter exclusion = new ClassFilter() {
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
return !(introducedInterface.isAssignableFrom(clazz));
|
||||
}
|
||||
};
|
||||
|
|
@ -109,8 +109,8 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class[] getInterfaces() {
|
||||
return new Class[] {this.introducedInterface};
|
||||
public Class<?>[] getInterfaces() {
|
||||
return new Class<?>[] {this.introducedInterface};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getDeclaringType() {
|
||||
public Class<?> getDeclaringType() {
|
||||
return methodInvocation.getMethod().getDeclaringClass();
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getReturnType() {
|
||||
public Class<?> getReturnType() {
|
||||
return methodInvocation.getMethod().getReturnType();
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class[] getParameterTypes() {
|
||||
public Class<?>[] getParameterTypes() {
|
||||
return methodInvocation.getMethod().getParameterTypes();
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class[] getExceptionTypes() {
|
||||
public Class<?>[] getExceptionTypes() {
|
||||
return methodInvocation.getMethod().getExceptionTypes();
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
sb.append(".");
|
||||
sb.append(getMethod().getName());
|
||||
sb.append("(");
|
||||
Class[] parametersTypes = getParameterTypes();
|
||||
Class<?>[] parametersTypes = getParameterTypes();
|
||||
appendTypes(sb, parametersTypes, includeReturnTypeAndArgs, useLongReturnAndArgumentTypeName);
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
|
|
@ -297,7 +297,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
private class SourceLocationImpl implements SourceLocation {
|
||||
|
||||
@Override
|
||||
public Class getWithinType() {
|
||||
public Class<?> getWithinType() {
|
||||
if (methodInvocation.getThis() == null) {
|
||||
throw new UnsupportedOperationException("No source location joinpoint available: target is null");
|
||||
}
|
||||
|
|
@ -315,6 +315,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public int getColumn() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,12 +87,12 @@ class RuntimeTestWalker {
|
|||
new SubtypeSensitiveVarTypeTestVisitor().testsSubtypeSensitiveVars(this.runtimeTest));
|
||||
}
|
||||
|
||||
public boolean testThisInstanceOfResidue(Class thisClass) {
|
||||
public boolean testThisInstanceOfResidue(Class<?> thisClass) {
|
||||
return (this.runtimeTest != null &&
|
||||
new ThisInstanceOfResidueTestVisitor(thisClass).thisInstanceOfMatches(this.runtimeTest));
|
||||
}
|
||||
|
||||
public boolean testTargetInstanceOfResidue(Class targetClass) {
|
||||
public boolean testTargetInstanceOfResidue(Class<?> targetClass) {
|
||||
return (this.runtimeTest != null &&
|
||||
new TargetInstanceOfResidueTestVisitor(targetClass).targetInstanceOfMatches(this.runtimeTest));
|
||||
}
|
||||
|
|
@ -169,11 +169,11 @@ class RuntimeTestWalker {
|
|||
|
||||
private static abstract class InstanceOfResidueTestVisitor extends TestVisitorAdapter {
|
||||
|
||||
private Class matchClass;
|
||||
private Class<?> matchClass;
|
||||
private boolean matches;
|
||||
private int matchVarType;
|
||||
|
||||
public InstanceOfResidueTestVisitor(Class matchClass, boolean defaultMatches, int matchVarType) {
|
||||
public InstanceOfResidueTestVisitor(Class<?> matchClass, boolean defaultMatches, int matchVarType) {
|
||||
this.matchClass = matchClass;
|
||||
this.matches = defaultMatches;
|
||||
this.matchVarType = matchVarType;
|
||||
|
|
@ -192,7 +192,7 @@ class RuntimeTestWalker {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
Class typeClass = ClassUtils.forName(type.getName(), this.matchClass.getClassLoader());
|
||||
Class<?> typeClass = ClassUtils.forName(type.getName(), this.matchClass.getClassLoader());
|
||||
// Don't use ReflectionType.isAssignableFrom() as it won't be aware of (Spring) mixins
|
||||
this.matches = typeClass.isAssignableFrom(this.matchClass);
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ class RuntimeTestWalker {
|
|||
*/
|
||||
private static class TargetInstanceOfResidueTestVisitor extends InstanceOfResidueTestVisitor {
|
||||
|
||||
public TargetInstanceOfResidueTestVisitor(Class targetClass) {
|
||||
public TargetInstanceOfResidueTestVisitor(Class<?> targetClass) {
|
||||
super(targetClass, false, TARGET_VAR);
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ class RuntimeTestWalker {
|
|||
*/
|
||||
private static class ThisInstanceOfResidueTestVisitor extends InstanceOfResidueTestVisitor {
|
||||
|
||||
public ThisInstanceOfResidueTestVisitor(Class thisClass) {
|
||||
public ThisInstanceOfResidueTestVisitor(Class<?> thisClass) {
|
||||
super(thisClass, true, THIS_VAR);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
public class SimpleAspectInstanceFactory implements AspectInstanceFactory {
|
||||
|
||||
private final Class aspectClass;
|
||||
private final Class<?> aspectClass;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new SimpleAspectInstanceFactory for the given aspect class.
|
||||
* @param aspectClass the aspect class
|
||||
*/
|
||||
public SimpleAspectInstanceFactory(Class aspectClass) {
|
||||
public SimpleAspectInstanceFactory(Class<?> aspectClass) {
|
||||
Assert.notNull(aspectClass, "Aspect class must not be null");
|
||||
this.aspectClass = aspectClass;
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ public class SimpleAspectInstanceFactory implements AspectInstanceFactory {
|
|||
/**
|
||||
* Return the specified aspect class (never {@code null}).
|
||||
*/
|
||||
public final Class getAspectClass() {
|
||||
public final Class<?> getAspectClass() {
|
||||
return this.aspectClass;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class TypePatternClassFilter implements ClassFilter {
|
|||
* @throws IllegalStateException if no {@link #setTypePattern(String)} has been set
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
if (this.aspectJTypePatternMatcher == null) {
|
||||
throw new IllegalStateException("No 'typePattern' has been set via ctor/setter.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,9 @@ import org.aspectj.lang.annotation.Pointcut;
|
|||
import org.aspectj.lang.reflect.AjType;
|
||||
import org.aspectj.lang.reflect.AjTypeSystem;
|
||||
import org.aspectj.lang.reflect.PerClauseKind;
|
||||
|
||||
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.core.PrioritizedParameterNameDiscoverer;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -67,11 +65,11 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
* (there <i>should</i> only be one anyway...)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method method) {
|
||||
Class<? extends Annotation>[] classesToLookFor = new Class[] {
|
||||
protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) {
|
||||
Class<?>[] classesToLookFor = new Class<?>[] {
|
||||
Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class};
|
||||
for (Class<? extends Annotation> c : classesToLookFor) {
|
||||
AspectJAnnotation foundAnnotation = findAnnotation(method, c);
|
||||
for (Class<?> c : classesToLookFor) {
|
||||
AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) c);
|
||||
if (foundAnnotation != null) {
|
||||
return foundAnnotation;
|
||||
}
|
||||
|
|
@ -156,7 +154,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
* formal parameters for the pointcut.
|
||||
*/
|
||||
protected AspectJExpressionPointcut createPointcutExpression(
|
||||
Method annotatedMethod, Class declarationScope, String[] pointcutParameterNames) {
|
||||
Method annotatedMethod, Class<?> declarationScope, String[] pointcutParameterNames) {
|
||||
|
||||
Class<?> [] pointcutParameterTypes = new Class<?>[0];
|
||||
if (pointcutParameterNames != null) {
|
||||
|
|
@ -210,8 +208,8 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
|
||||
private static final String[] EXPRESSION_PROPERTIES = new String[] {"value", "pointcut"};
|
||||
|
||||
private static Map<Class, AspectJAnnotationType> annotationTypes =
|
||||
new HashMap<Class, AspectJAnnotationType>();
|
||||
private static Map<Class<?>, AspectJAnnotationType> annotationTypes =
|
||||
new HashMap<Class<?>, AspectJAnnotationType>();
|
||||
|
||||
static {
|
||||
annotationTypes.put(Pointcut.class,AspectJAnnotationType.AtPointcut);
|
||||
|
|
@ -245,7 +243,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
}
|
||||
|
||||
private AspectJAnnotationType determineAnnotationType(A annotation) {
|
||||
for (Class type : annotationTypes.keySet()) {
|
||||
for (Class<?> type : annotationTypes.keySet()) {
|
||||
if (type.isInstance(annotation)) {
|
||||
return annotationTypes.get(type);
|
||||
}
|
||||
|
|
@ -307,7 +305,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
if (method.getParameterTypes().length == 0) {
|
||||
return new String[0];
|
||||
}
|
||||
AspectJAnnotation annotation = findAspectJAnnotationOnMethod(method);
|
||||
AspectJAnnotation<?> annotation = findAspectJAnnotationOnMethod(method);
|
||||
if (annotation == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -325,7 +323,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterNames(Constructor ctor) {
|
||||
public String[] getParameterNames(Constructor<?> ctor) {
|
||||
throw new UnsupportedOperationException("Spring AOP cannot handle constructor advice");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInfrastructureClass(Class beanClass) {
|
||||
protected boolean isInfrastructureClass(Class<?> beanClass) {
|
||||
// Previously we setProxyTargetClass(true) in the constructor, but that has too
|
||||
// broad an impact. Instead we now override isInfrastructureClass to avoid proxying
|
||||
// aspects. I'm not entirely happy with that as there is no good reason not
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import org.springframework.util.ClassUtils;
|
|||
public class AspectJProxyFactory extends ProxyCreatorSupport {
|
||||
|
||||
/** Cache for singleton aspect instances */
|
||||
private static final Map<Class, Object> aspectCache = new HashMap<Class, Object>();
|
||||
private static final Map<Class<?>, Object> aspectCache = new HashMap<Class<?>, Object>();
|
||||
|
||||
private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory();
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
|
|||
* Create a new {@code AspectJProxyFactory}.
|
||||
* No target, only interfaces. Must add interceptors.
|
||||
*/
|
||||
public AspectJProxyFactory(Class[] interfaces) {
|
||||
public AspectJProxyFactory(Class<?>[] interfaces) {
|
||||
setInterfaces(interfaces);
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
|
|||
* @param aspectInstance the AspectJ aspect instance
|
||||
*/
|
||||
public void addAspect(Object aspectInstance) {
|
||||
Class aspectClass = aspectInstance.getClass();
|
||||
Class<?> aspectClass = aspectInstance.getClass();
|
||||
String aspectName = aspectClass.getName();
|
||||
AspectMetadata am = createAspectMetadata(aspectClass, aspectName);
|
||||
if (am.getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON) {
|
||||
|
|
@ -104,7 +104,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
|
|||
* Add an aspect of the supplied type to the end of the advice chain.
|
||||
* @param aspectClass the AspectJ aspect class
|
||||
*/
|
||||
public void addAspect(Class aspectClass) {
|
||||
public void addAspect(Class<?> aspectClass) {
|
||||
String aspectName = aspectClass.getName();
|
||||
AspectMetadata am = createAspectMetadata(aspectClass, aspectName);
|
||||
MetadataAwareAspectInstanceFactory instanceFactory = createAspectInstanceFactory(am, aspectClass, aspectName);
|
||||
|
|
@ -128,7 +128,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
|
|||
/**
|
||||
* Create an {@link AspectMetadata} instance for the supplied aspect type.
|
||||
*/
|
||||
private AspectMetadata createAspectMetadata(Class aspectClass, String aspectName) {
|
||||
private AspectMetadata createAspectMetadata(Class<?> aspectClass, String aspectName) {
|
||||
AspectMetadata am = new AspectMetadata(aspectClass, aspectName);
|
||||
if (!am.getAjType().isAspect()) {
|
||||
throw new IllegalArgumentException("Class [" + aspectClass.getName() + "] is not a valid aspect type");
|
||||
|
|
@ -142,7 +142,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
|
|||
* a {@link PrototypeAspectInstanceFactory} is returned.
|
||||
*/
|
||||
private MetadataAwareAspectInstanceFactory createAspectInstanceFactory(
|
||||
AspectMetadata am, Class aspectClass, String aspectName) {
|
||||
AspectMetadata am, Class<?> aspectClass, String aspectName) {
|
||||
|
||||
MetadataAwareAspectInstanceFactory instanceFactory = null;
|
||||
if (am.getAjType().getPerClause().getKind() == PerClauseKind.SINGLETON) {
|
||||
|
|
@ -161,7 +161,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport {
|
|||
* Get the singleton aspect instance for the supplied aspect type. An instance
|
||||
* is created if one cannot be found in the instance cache.
|
||||
*/
|
||||
private Object getSingletonAspectInstance(Class aspectClass) {
|
||||
private Object getSingletonAspectInstance(Class<?> aspectClass) {
|
||||
synchronized (aspectCache) {
|
||||
Object instance = aspectCache.get(aspectClass);
|
||||
if (instance != null) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class AspectMetadata {
|
|||
/**
|
||||
* AspectJ reflection information (AspectJ 5 / Java 5 specific).
|
||||
*/
|
||||
private final AjType ajType;
|
||||
private final AjType<?> ajType;
|
||||
|
||||
/**
|
||||
* Spring AOP pointcut corresponding to the per clause of the
|
||||
|
|
@ -71,9 +71,9 @@ public class AspectMetadata {
|
|||
this.aspectName = aspectName;
|
||||
|
||||
Class<?> currClass = aspectClass;
|
||||
AjType ajType = null;
|
||||
AjType<?> ajType = null;
|
||||
while (!currClass.equals(Object.class)) {
|
||||
AjType ajTypeToCheck = AjTypeSystem.getAjType(currClass);
|
||||
AjType<?> ajTypeToCheck = AjTypeSystem.getAjType(currClass);
|
||||
if (ajTypeToCheck.isAspect()) {
|
||||
ajType = ajTypeToCheck;
|
||||
break;
|
||||
|
|
@ -124,14 +124,14 @@ public class AspectMetadata {
|
|||
/**
|
||||
* Return AspectJ reflection information.
|
||||
*/
|
||||
public AjType getAjType() {
|
||||
public AjType<?> getAjType() {
|
||||
return this.ajType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the aspect class.
|
||||
*/
|
||||
public Class getAspectClass() {
|
||||
public Class<?> getAspectClass() {
|
||||
return this.ajType.getJavaClass();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class BeanFactoryAspectInstanceFactory implements MetadataAwareAspectInst
|
|||
* @param name the name of the bean
|
||||
* @param type the type that should be introspected by AspectJ
|
||||
*/
|
||||
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class type) {
|
||||
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class<?> type) {
|
||||
this.beanFactory = beanFactory;
|
||||
this.name = name;
|
||||
this.aspectMetadata = new AspectMetadata(type, name);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
|
|||
// We must be careful not to instantiate beans eagerly as in this
|
||||
// case they would be cached by the Spring container but would not
|
||||
// have been weaved
|
||||
Class beanType = this.beanFactory.getType(beanName);
|
||||
Class<?> beanType = this.beanFactory.getType(beanName);
|
||||
if (beanType == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
|
|||
}
|
||||
|
||||
if (aspectNames.isEmpty()) {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
for (String aspectName : aspectNames) {
|
||||
|
|
|
|||
|
|
@ -249,14 +249,14 @@ class InstantiationModelAwarePointcutAdvisorImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
// We're either instantiated and matching on declared pointcut, or uninstantiated matching on either pointcut
|
||||
return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass)) ||
|
||||
this.preInstantiationPointcut.getMethodMatcher().matches(method, targetClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, Object[] args) {
|
||||
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
|
||||
// This can match only on declared pointcut.
|
||||
return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
return null;
|
||||
}
|
||||
AspectJExpressionPointcut ajexp =
|
||||
new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class[0]);
|
||||
new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]);
|
||||
ajexp.setExpression(aspectJAnnotation.getPointcutExpression());
|
||||
return ajexp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class SimpleMetadataAwareAspectInstanceFactory extends SimpleAspectInstan
|
|||
* @param aspectClass the aspect class
|
||||
* @param aspectName the aspect name
|
||||
*/
|
||||
public SimpleMetadataAwareAspectInstanceFactory(Class aspectClass, String aspectName) {
|
||||
public SimpleMetadataAwareAspectInstanceFactory(Class<?> aspectClass, String aspectName) {
|
||||
super(aspectClass);
|
||||
this.metadata = new AspectMetadata(aspectClass, aspectName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import org.springframework.util.ClassUtils;
|
|||
@SuppressWarnings("serial")
|
||||
public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator {
|
||||
|
||||
private static final Comparator DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator();
|
||||
private static final Comparator<Advisor> DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -98,7 +98,7 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldSkip(Class beanClass, String beanName) {
|
||||
protected boolean shouldSkip(Class<?> beanClass, String beanName) {
|
||||
// TODO: Consider optimization by caching the list of the aspect names
|
||||
List<Advisor> candidateAdvisors = findCandidateAdvisors();
|
||||
for (Advisor advisor : candidateAdvisors) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import org.springframework.util.Assert;
|
|||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
class AspectJPrecedenceComparator implements Comparator {
|
||||
class AspectJPrecedenceComparator implements Comparator<Advisor> {
|
||||
|
||||
private static final int HIGHER_PRECEDENCE = -1;
|
||||
private static final int SAME_PRECEDENCE = 0;
|
||||
|
|
@ -76,18 +76,10 @@ class AspectJPrecedenceComparator implements Comparator {
|
|||
|
||||
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
if (!(o1 instanceof Advisor && o2 instanceof Advisor)) {
|
||||
throw new IllegalArgumentException(
|
||||
"AspectJPrecedenceComparator can only compare the order of Advisors, " +
|
||||
"but was passed [" + o1 + "] and [" + o2 + "]");
|
||||
}
|
||||
|
||||
Advisor advisor1 = (Advisor) o1;
|
||||
Advisor advisor2 = (Advisor) o2;
|
||||
int advisorPrecedence = this.advisorComparator.compare(advisor1, advisor2);
|
||||
if (advisorPrecedence == SAME_PRECEDENCE && declaredInSameAspect(advisor1, advisor2)) {
|
||||
advisorPrecedence = comparePrecedenceWithinAspect(advisor1, advisor2);
|
||||
public int compare(Advisor o1, Advisor o2) {
|
||||
int advisorPrecedence = this.advisorComparator.compare(o1, o2);
|
||||
if (advisorPrecedence == SAME_PRECEDENCE && declaredInSameAspect(o1, o2)) {
|
||||
advisorPrecedence = comparePrecedenceWithinAspect(o1, o2);
|
||||
}
|
||||
return advisorPrecedence;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public abstract class AopConfigUtils {
|
|||
/**
|
||||
* Stores the auto proxy creator classes in escalation order.
|
||||
*/
|
||||
private static final List<Class> APC_PRIORITY_LIST = new ArrayList<Class>();
|
||||
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<Class<?>>();
|
||||
|
||||
/**
|
||||
* Setup the escalation list.
|
||||
|
|
@ -105,7 +105,7 @@ public abstract class AopConfigUtils {
|
|||
}
|
||||
|
||||
|
||||
private static BeanDefinition registerOrEscalateApcAsRequired(Class cls, BeanDefinitionRegistry registry, Object source) {
|
||||
private static BeanDefinition registerOrEscalateApcAsRequired(Class<?> cls, BeanDefinitionRegistry registry, Object source) {
|
||||
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
|
||||
if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) {
|
||||
BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
|
||||
|
|
@ -126,13 +126,13 @@ public abstract class AopConfigUtils {
|
|||
return beanDefinition;
|
||||
}
|
||||
|
||||
private static int findPriorityForClass(Class clazz) {
|
||||
private static int findPriorityForClass(Class<?> clazz) {
|
||||
return APC_PRIORITY_LIST.indexOf(clazz);
|
||||
}
|
||||
|
||||
private static int findPriorityForClass(String className) {
|
||||
for (int i = 0; i < APC_PRIORITY_LIST.size(); i++) {
|
||||
Class clazz = APC_PRIORITY_LIST.get(i);
|
||||
Class<?> clazz = APC_PRIORITY_LIST.get(i);
|
||||
if (clazz.getName().equals(className)) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
/**
|
||||
* Gets the advice implementation class corresponding to the supplied {@link Element}.
|
||||
*/
|
||||
private Class getAdviceClass(Element adviceElement, ParserContext parserContext) {
|
||||
private Class<?> getAdviceClass(Element adviceElement, ParserContext parserContext) {
|
||||
String elementName = parserContext.getDelegate().getLocalName(adviceElement);
|
||||
if (BEFORE.equals(elementName)) {
|
||||
return AspectJMethodBeforeAdvice.class;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class MethodLocatingFactoryBean implements FactoryBean<Method>, BeanFacto
|
|||
throw new IllegalArgumentException("Property 'methodName' is required");
|
||||
}
|
||||
|
||||
Class beanClass = beanFactory.getType(this.targetBeanName);
|
||||
Class<?> beanClass = beanFactory.getType(this.targetBeanName);
|
||||
if (beanClass == null) {
|
||||
throw new IllegalArgumentException("Can't determine type of bean with name '" + this.targetBeanName + "'");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public abstract class AbstractAdvisingBeanPostProcessor extends ProxyConfig
|
|||
*/
|
||||
private int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
private final Map<Class, Boolean> eligibleBeans = new ConcurrentHashMap<Class, Boolean>(64);
|
||||
private final Map<Class<?>, Boolean> eligibleBeans = new ConcurrentHashMap<Class<?>, Boolean>(64);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ import org.springframework.util.CollectionUtils;
|
|||
* @author Juergen Hoeller
|
||||
* @see org.springframework.aop.framework.AopProxy
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
|
||||
/** use serialVersionUID from Spring 2.0 for interoperability */
|
||||
|
|
@ -88,7 +87,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
* Interfaces to be implemented by the proxy. Held in List to keep the order
|
||||
* of registration, to create JDK proxy with specified order of interfaces.
|
||||
*/
|
||||
private List<Class> interfaces = new ArrayList<Class>();
|
||||
private List<Class<?>> interfaces = new ArrayList<Class<?>>();
|
||||
|
||||
/**
|
||||
* List of Advisors. If an Advice is added, it will be wrapped
|
||||
|
|
@ -114,7 +113,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
* Create a AdvisedSupport instance with the given parameters.
|
||||
* @param interfaces the proxied interfaces
|
||||
*/
|
||||
public AdvisedSupport(Class[] interfaces) {
|
||||
public AdvisedSupport(Class<?>[] interfaces) {
|
||||
this();
|
||||
setInterfaces(interfaces);
|
||||
}
|
||||
|
|
@ -202,7 +201,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
public void setInterfaces(Class<?>... interfaces) {
|
||||
Assert.notNull(interfaces, "Interfaces must not be null");
|
||||
this.interfaces.clear();
|
||||
for (Class ifc : interfaces) {
|
||||
for (Class<?> ifc : interfaces) {
|
||||
addInterface(ifc);
|
||||
}
|
||||
}
|
||||
|
|
@ -235,12 +234,12 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
|
||||
@Override
|
||||
public Class<?>[] getProxiedInterfaces() {
|
||||
return this.interfaces.toArray(new Class[this.interfaces.size()]);
|
||||
return this.interfaces.toArray(new Class<?>[this.interfaces.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInterfaceProxied(Class<?> intf) {
|
||||
for (Class proxyIntf : this.interfaces) {
|
||||
for (Class<?> proxyIntf : this.interfaces) {
|
||||
if (intf.isAssignableFrom(proxyIntf)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -355,8 +354,8 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
private void validateIntroductionAdvisor(IntroductionAdvisor advisor) {
|
||||
advisor.validateInterfaces();
|
||||
// If the advisor passed validation, we can make the change.
|
||||
Class[] ifcs = advisor.getInterfaces();
|
||||
for (Class ifc : ifcs) {
|
||||
Class<?>[] ifcs = advisor.getInterfaces();
|
||||
for (Class<?> ifc : ifcs) {
|
||||
addInterface(ifc);
|
||||
}
|
||||
}
|
||||
|
|
@ -463,7 +462,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
* @param adviceClass the advice class to check
|
||||
* @return the count of the interceptors of this class or subclasses
|
||||
*/
|
||||
public int countAdvicesOfType(Class adviceClass) {
|
||||
public int countAdvicesOfType(Class<?> adviceClass) {
|
||||
int count = 0;
|
||||
if (adviceClass != null) {
|
||||
for (Advisor advisor : this.advisors) {
|
||||
|
|
@ -483,7 +482,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
* @param targetClass the target class
|
||||
* @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
|
||||
*/
|
||||
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass) {
|
||||
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(Method method, Class<?> targetClass) {
|
||||
MethodCacheKey cacheKey = new MethodCacheKey(method);
|
||||
List<Object> cached = this.methodCache.get(cacheKey);
|
||||
if (cached == null) {
|
||||
|
|
@ -521,7 +520,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
copyFrom(other);
|
||||
this.targetSource = targetSource;
|
||||
this.advisorChainFactory = other.advisorChainFactory;
|
||||
this.interfaces = new ArrayList<Class>(other.interfaces);
|
||||
this.interfaces = new ArrayList<Class<?>>(other.interfaces);
|
||||
for (Advisor advisor : advisors) {
|
||||
if (advisor instanceof IntroductionAdvisor) {
|
||||
validateIntroductionAdvisor((IntroductionAdvisor) advisor);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,6 @@ public interface AdvisorChainFactory {
|
|||
* @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
|
||||
*/
|
||||
List<Object> getInterceptorsAndDynamicInterceptionAdvice(
|
||||
Advised config, Method method, Class targetClass);
|
||||
Advised config, Method method, Class<?> targetClass);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,13 +78,13 @@ public abstract class AopProxyUtils {
|
|||
* @see Advised
|
||||
* @see org.springframework.aop.SpringProxy
|
||||
*/
|
||||
public static Class[] completeProxiedInterfaces(AdvisedSupport advised) {
|
||||
Class[] specifiedInterfaces = advised.getProxiedInterfaces();
|
||||
public static Class<?>[] completeProxiedInterfaces(AdvisedSupport advised) {
|
||||
Class<?>[] specifiedInterfaces = advised.getProxiedInterfaces();
|
||||
if (specifiedInterfaces.length == 0) {
|
||||
// No user-specified interfaces: check whether target class is an interface.
|
||||
Class targetClass = advised.getTargetClass();
|
||||
Class<?> targetClass = advised.getTargetClass();
|
||||
if (targetClass != null && targetClass.isInterface()) {
|
||||
specifiedInterfaces = new Class[] {targetClass};
|
||||
specifiedInterfaces = new Class<?>[] {targetClass};
|
||||
}
|
||||
}
|
||||
boolean addSpringProxy = !advised.isInterfaceProxied(SpringProxy.class);
|
||||
|
|
@ -96,7 +96,7 @@ public abstract class AopProxyUtils {
|
|||
if (addAdvised) {
|
||||
nonUserIfcCount++;
|
||||
}
|
||||
Class[] proxiedInterfaces = new Class[specifiedInterfaces.length + nonUserIfcCount];
|
||||
Class<?>[] proxiedInterfaces = new Class<?>[specifiedInterfaces.length + nonUserIfcCount];
|
||||
System.arraycopy(specifiedInterfaces, 0, proxiedInterfaces, 0, specifiedInterfaces.length);
|
||||
if (addSpringProxy) {
|
||||
proxiedInterfaces[specifiedInterfaces.length] = SpringProxy.class;
|
||||
|
|
@ -115,8 +115,8 @@ public abstract class AopProxyUtils {
|
|||
* in the original order (never {@code null} or empty)
|
||||
* @see Advised
|
||||
*/
|
||||
public static Class[] proxiedUserInterfaces(Object proxy) {
|
||||
Class[] proxyInterfaces = proxy.getClass().getInterfaces();
|
||||
public static Class<?>[] proxiedUserInterfaces(Object proxy) {
|
||||
Class<?>[] proxyInterfaces = proxy.getClass().getInterfaces();
|
||||
int nonUserIfcCount = 0;
|
||||
if (proxy instanceof SpringProxy) {
|
||||
nonUserIfcCount++;
|
||||
|
|
@ -124,7 +124,7 @@ public abstract class AopProxyUtils {
|
|||
if (proxy instanceof Advised) {
|
||||
nonUserIfcCount++;
|
||||
}
|
||||
Class[] userInterfaces = new Class[proxyInterfaces.length - nonUserIfcCount];
|
||||
Class<?>[] userInterfaces = new Class<?>[proxyInterfaces.length - nonUserIfcCount];
|
||||
System.arraycopy(proxyInterfaces, 0, userInterfaces, 0, userInterfaces.length);
|
||||
Assert.notEmpty(userInterfaces, "JDK proxy must implement one or more interfaces");
|
||||
return userInterfaces;
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
enhancer.setInterfaces(AopProxyUtils.completeProxiedInterfaces(this.advised));
|
||||
|
||||
Callback[] callbacks = getCallbacks(rootClass);
|
||||
Class<?>[] types = new Class[callbacks.length];
|
||||
Class<?>[] types = new Class<?>[callbacks.length];
|
||||
|
||||
for (int x = 0; x < types.length; x++) {
|
||||
types[x] = callbacks[x].getClass();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializ
|
|||
|
||||
@Override
|
||||
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(
|
||||
Advised config, Method method, Class targetClass) {
|
||||
Advised config, Method method, Class<?> targetClass) {
|
||||
|
||||
// This is somewhat tricky... we have to process introductions first,
|
||||
// but we need to preserve order in the ultimate list.
|
||||
|
|
@ -94,7 +94,7 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializ
|
|||
/**
|
||||
* Determine whether the Advisors contain matching introductions.
|
||||
*/
|
||||
private static boolean hasMatchingIntroductions(Advised config, Class targetClass) {
|
||||
private static boolean hasMatchingIntroductions(Advised config, Class<?> targetClass) {
|
||||
for (int i = 0; i < config.getAdvisors().length; i++) {
|
||||
Advisor advisor = config.getAdvisors()[i];
|
||||
if (advisor instanceof IntroductionAdvisor) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
|
|||
@Override
|
||||
public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException {
|
||||
if (config.isOptimize() || config.isProxyTargetClass() || hasNoUserSuppliedProxyInterfaces(config)) {
|
||||
Class targetClass = config.getTargetClass();
|
||||
Class<?> targetClass = config.getTargetClass();
|
||||
if (targetClass == null) {
|
||||
throw new AopConfigException("TargetSource cannot determine target class: " +
|
||||
"Either an interface or a target is required for proxy creation.");
|
||||
|
|
@ -72,7 +72,7 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
|
|||
* (or no proxy interfaces specified at all).
|
||||
*/
|
||||
private boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config) {
|
||||
Class[] interfaces = config.getProxiedInterfaces();
|
||||
Class<?>[] interfaces = config.getProxiedInterfaces();
|
||||
return (interfaces.length == 0 || (interfaces.length == 1 && SpringProxy.class.equals(interfaces[0])));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource());
|
||||
}
|
||||
Class[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised);
|
||||
Class<?>[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised);
|
||||
findDefinedEqualsAndHashCodeMethods(proxiedInterfaces);
|
||||
return Proxy.newProxyInstance(classLoader, proxiedInterfaces, this);
|
||||
}
|
||||
|
|
@ -126,8 +126,8 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
|||
* on the supplied set of interfaces.
|
||||
* @param proxiedInterfaces the interfaces to introspect
|
||||
*/
|
||||
private void findDefinedEqualsAndHashCodeMethods(Class[] proxiedInterfaces) {
|
||||
for (Class proxiedInterface : proxiedInterfaces) {
|
||||
private void findDefinedEqualsAndHashCodeMethods(Class<?>[] proxiedInterfaces) {
|
||||
for (Class<?> proxiedInterface : proxiedInterfaces) {
|
||||
Method[] methods = proxiedInterface.getDeclaredMethods();
|
||||
for (Method method : methods) {
|
||||
if (AopUtils.isEqualsMethod(method)) {
|
||||
|
|
@ -156,7 +156,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
|||
boolean setProxyContext = false;
|
||||
|
||||
TargetSource targetSource = this.advised.targetSource;
|
||||
Class targetClass = null;
|
||||
Class<?> targetClass = null;
|
||||
Object target = null;
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.springframework.objenesis.ObjenesisStd;
|
|||
* @author Oliver Gierke
|
||||
* @since 4.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class ObjenesisCglibAopProxy extends CglibAopProxy {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ObjenesisCglibAopProxy.class);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
* @see #setInterfaces
|
||||
* @see AbstractSingletonProxyFactoryBean#setProxyInterfaces
|
||||
*/
|
||||
public void setProxyInterfaces(Class[] proxyInterfaces) throws ClassNotFoundException {
|
||||
public void setProxyInterfaces(Class<?>[] proxyInterfaces) throws ClassNotFoundException {
|
||||
setInterfaces(proxyInterfaces);
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
return this.singletonInstance.getClass();
|
||||
}
|
||||
}
|
||||
Class[] ifcs = getProxiedInterfaces();
|
||||
Class<?>[] ifcs = getProxiedInterfaces();
|
||||
if (ifcs.length == 1) {
|
||||
return ifcs[0];
|
||||
}
|
||||
|
|
@ -297,7 +297,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
* @return the merged interface as Class
|
||||
* @see java.lang.reflect.Proxy#getProxyClass
|
||||
*/
|
||||
protected Class createCompositeInterface(Class[] interfaces) {
|
||||
protected Class<?> createCompositeInterface(Class<?>[] interfaces) {
|
||||
return ClassUtils.createCompositeInterface(interfaces, this.proxyClassLoader);
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +311,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
this.targetSource = freshTargetSource();
|
||||
if (this.autodetectInterfaces && getProxiedInterfaces().length == 0 && !isProxyTargetClass()) {
|
||||
// Rely on AOP infrastructure to tell us what interfaces to proxy.
|
||||
Class targetClass = getTargetClass();
|
||||
Class<?> targetClass = getTargetClass();
|
||||
if (targetClass == null) {
|
||||
throw new FactoryBeanNotInitializedException("Cannot determine target class for proxy");
|
||||
}
|
||||
|
|
@ -401,7 +401,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
* @return {@code true} if it's an Advisor or Advice
|
||||
*/
|
||||
private boolean isNamedBeanAnAdvisorOrAdvice(String beanName) {
|
||||
Class namedBeanClass = this.beanFactory.getType(beanName);
|
||||
Class<?> namedBeanClass = this.beanFactory.getType(beanName);
|
||||
if (namedBeanClass != null) {
|
||||
return (Advisor.class.isAssignableFrom(namedBeanClass) || Advice.class.isAssignableFrom(namedBeanClass));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
|
||||
protected Object[] arguments;
|
||||
|
||||
private final Class targetClass;
|
||||
private final Class<?> targetClass;
|
||||
|
||||
/**
|
||||
* Lazily initialized map of user-specific attributes for this invocation.
|
||||
|
|
@ -79,7 +79,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
* List of MethodInterceptor and InterceptorAndDynamicMethodMatcher
|
||||
* that need dynamic checks.
|
||||
*/
|
||||
protected final List interceptorsAndDynamicMethodMatchers;
|
||||
protected final List<?> interceptorsAndDynamicMethodMatchers;
|
||||
|
||||
/**
|
||||
* Index from 0 of the current interceptor we're invoking.
|
||||
|
|
@ -103,7 +103,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
*/
|
||||
protected ReflectiveMethodInvocation(
|
||||
Object proxy, Object target, Method method, Object[] arguments,
|
||||
Class targetClass, List<Object> interceptorsAndDynamicMethodMatchers) {
|
||||
Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers) {
|
||||
|
||||
this.proxy = proxy;
|
||||
this.target = target;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
|||
private final Object throwsAdvice;
|
||||
|
||||
/** Methods on throws advice, keyed by exception class */
|
||||
private final Map<Class, Method> exceptionHandlerMap = new HashMap<Class, Method>();
|
||||
private final Map<Class<?>, Method> exceptionHandlerMap = new HashMap<Class<?>, Method>();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -104,7 +104,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
|||
* @return a handler for the given exception type
|
||||
*/
|
||||
private Method getExceptionHandler(Throwable exception) {
|
||||
Class exceptionClass = exception.getClass();
|
||||
Class<?> exceptionClass = exception.getClass();
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Trying to find handler for exception of type [" + exceptionClass.getName() + "]");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
|
|||
|
||||
|
||||
@Override
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
|
||||
List advisors = findEligibleAdvisors(beanClass, beanName);
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource targetSource) {
|
||||
List<Advisor> advisors = findEligibleAdvisors(beanClass, beanName);
|
||||
if (advisors.isEmpty()) {
|
||||
return DO_NOT_PROXY;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
|
|||
* @see #sortAdvisors
|
||||
* @see #extendAdvisors
|
||||
*/
|
||||
protected List<Advisor> findEligibleAdvisors(Class beanClass, String beanName) {
|
||||
protected List<Advisor> findEligibleAdvisors(Class<?> beanClass, String beanName) {
|
||||
List<Advisor> candidateAdvisors = findCandidateAdvisors();
|
||||
List<Advisor> eligibleAdvisors = findAdvisorsThatCanApply(candidateAdvisors, beanClass, beanName);
|
||||
extendAdvisors(eligibleAdvisors);
|
||||
|
|
@ -111,7 +111,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
|
|||
* @see ProxyCreationContext#getCurrentProxiedBeanName()
|
||||
*/
|
||||
protected List<Advisor> findAdvisorsThatCanApply(
|
||||
List<Advisor> candidateAdvisors, Class beanClass, String beanName) {
|
||||
List<Advisor> candidateAdvisors, Class<?> beanClass, String beanName) {
|
||||
|
||||
ProxyCreationContext.setCurrentProxiedBeanName(beanName);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
|
|||
* Identify as bean to proxy if the bean name is in the configured list of names.
|
||||
*/
|
||||
@Override
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) {
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource targetSource) {
|
||||
if (this.beanNames != null) {
|
||||
for (String mappedName : this.beanNames) {
|
||||
if (FactoryBean.class.isAssignableFrom(beanClass)) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class LazyInitTargetSourceCreator extends AbstractBeanFactoryBasedTargetS
|
|||
|
||||
@Override
|
||||
protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
Class beanClass, String beanName) {
|
||||
Class<?> beanClass, String beanName) {
|
||||
|
||||
if (getBeanFactory() instanceof ConfigurableListableBeanFactory) {
|
||||
BeanDefinition definition =
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSour
|
|||
|
||||
@Override
|
||||
protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
Class beanClass, String beanName) {
|
||||
Class<?> beanClass, String beanName) {
|
||||
|
||||
if (beanName.startsWith(PREFIX_COMMONS_POOL)) {
|
||||
CommonsPoolTargetSource cpts = new CommonsPoolTargetSource();
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public abstract class AbstractMonitoringInterceptor extends AbstractTraceInterce
|
|||
protected String createInvocationTraceName(MethodInvocation invocation) {
|
||||
StringBuilder sb = new StringBuilder(getPrefix());
|
||||
Method method = invocation.getMethod();
|
||||
Class clazz = method.getDeclaringClass();
|
||||
Class<?> clazz = method.getDeclaringClass();
|
||||
if (this.logTargetClassInvocation && clazz.isInstance(invocation.getThis())) {
|
||||
clazz = invocation.getThis().getClass();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public abstract class AbstractTraceInterceptor implements MethodInterceptor, Ser
|
|||
* @return the target class for the given object
|
||||
* @see #setHideProxyClassNames
|
||||
*/
|
||||
protected Class getClassForLogging(Object target) {
|
||||
protected Class<?> getClassForLogging(Object target) {
|
||||
return (this.hideProxyClassNames ? AopUtils.getTargetClass(target) : target.getClass());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
|
|||
/**
|
||||
* The {@code Set} of allowed placeholders.
|
||||
*/
|
||||
private static final Set ALLOWED_PLACEHOLDERS =
|
||||
private static final Set<Object> ALLOWED_PLACEHOLDERS =
|
||||
new Constants(CustomizableTraceInterceptor.class).getValues("PLACEHOLDER_");
|
||||
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
|
|||
* @param output the {@code StringBuffer} containing the output
|
||||
*/
|
||||
private void appendArgumentTypes(MethodInvocation methodInvocation, Matcher matcher, StringBuffer output) {
|
||||
Class[] argumentTypes = methodInvocation.getMethod().getParameterTypes();
|
||||
Class<?>[] argumentTypes = methodInvocation.getMethod().getParameterTypes();
|
||||
String[] argumentTypeShortNames = new String[argumentTypes.length];
|
||||
for (int i = 0; i < argumentTypeShortNames.length; i++) {
|
||||
argumentTypeShortNames[i] = ClassUtils.getShortName(argumentTypes[i]);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class ScopedProxyFactoryBean extends ProxyConfig implements FactoryBean<O
|
|||
pf.copyFrom(this);
|
||||
pf.setTargetSource(this.scopedTargetSource);
|
||||
|
||||
Class beanType = beanFactory.getType(this.targetBeanName);
|
||||
Class<?> beanType = beanFactory.getType(this.targetBeanName);
|
||||
if (beanType == null) {
|
||||
throw new IllegalStateException("Cannot create scoped proxy for bean '" + this.targetBeanName +
|
||||
"': Target type could not be determined at the time of proxy creation.");
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
|
|||
* plus the name of the method.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return ((targetClass != null && matchesPattern(targetClass.getName() + "." + method.getName())) ||
|
||||
matchesPattern(method.getDeclaringClass().getName() + "." + method.getName()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ public abstract class AopUtils {
|
|||
introductionAwareMethodMatcher = (IntroductionAwareMethodMatcher) methodMatcher;
|
||||
}
|
||||
|
||||
Set<Class> classes = new HashSet<Class>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
|
||||
Set<Class<?>> classes = new HashSet<Class<?>>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
|
||||
classes.add(targetClass);
|
||||
for (Class<?> clazz : classes) {
|
||||
Method[] methods = clazz.getMethods();
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public abstract class ClassFilters {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
for (int i = 0; i < this.filters.length; i++) {
|
||||
if (this.filters[i].matches(clazz)) {
|
||||
return true;
|
||||
|
|
@ -132,7 +132,7 @@ public abstract class ClassFilters {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
for (int i = 0; i < this.filters.length; i++) {
|
||||
if (!this.filters[i].matches(clazz)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.springframework.util.ObjectUtils;
|
|||
@SuppressWarnings("serial")
|
||||
public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher, Serializable {
|
||||
|
||||
private Class clazz;
|
||||
private Class<?> clazz;
|
||||
|
||||
private String methodName;
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
|||
* Construct a new pointcut that matches all control flows below that class.
|
||||
* @param clazz the clazz
|
||||
*/
|
||||
public ControlFlowPointcut(Class clazz) {
|
||||
public ControlFlowPointcut(Class<?> clazz) {
|
||||
this(clazz, null);
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
|||
* @param clazz the clazz
|
||||
* @param methodName the name of the method
|
||||
*/
|
||||
public ControlFlowPointcut(Class clazz, String methodName) {
|
||||
public ControlFlowPointcut(Class<?> clazz, String methodName) {
|
||||
Assert.notNull(clazz, "Class must not be null");
|
||||
this.clazz = clazz;
|
||||
this.methodName = methodName;
|
||||
|
|
@ -72,7 +72,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
|||
* Subclasses can override this for greater filtering (and performance).
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
|||
* some candidate classes.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, Object[] args) {
|
||||
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
|
||||
++this.evaluations;
|
||||
ControlFlow cflow = ControlFlowFactory.createControlFlow();
|
||||
return (this.methodName != null) ? cflow.under(this.clazz, this.methodName) : cflow.under(this.clazz);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
|||
|
||||
private final Advice advice;
|
||||
|
||||
private final Set<Class> interfaces = new HashSet<Class>();
|
||||
private final Set<Class<?>> interfaces = new HashSet<Class<?>>();
|
||||
|
||||
private int order = Integer.MAX_VALUE;
|
||||
|
||||
|
|
@ -68,11 +68,11 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
|||
Assert.notNull(advice, "Advice must not be null");
|
||||
this.advice = advice;
|
||||
if (introductionInfo != null) {
|
||||
Class[] introducedInterfaces = introductionInfo.getInterfaces();
|
||||
Class<?>[] introducedInterfaces = introductionInfo.getInterfaces();
|
||||
if (introducedInterfaces.length == 0) {
|
||||
throw new IllegalArgumentException("IntroductionAdviceSupport implements no interfaces");
|
||||
}
|
||||
for (Class ifc : introducedInterfaces) {
|
||||
for (Class<?> ifc : introducedInterfaces) {
|
||||
addInterface(ifc);
|
||||
}
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
|||
* @param advice the Advice to apply
|
||||
* @param intf the interface to introduce
|
||||
*/
|
||||
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class intf) {
|
||||
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> intf) {
|
||||
Assert.notNull(advice, "Advice must not be null");
|
||||
this.advice = advice;
|
||||
addInterface(intf);
|
||||
|
|
@ -94,7 +94,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
|||
* Add the specified interface to the list of interfaces to introduce.
|
||||
* @param intf the interface to introduce
|
||||
*/
|
||||
public void addInterface(Class intf) {
|
||||
public void addInterface(Class<?> intf) {
|
||||
Assert.notNull(intf, "Interface must not be null");
|
||||
if (!intf.isInterface()) {
|
||||
throw new IllegalArgumentException("Specified class [" + intf.getName() + "] must be an interface");
|
||||
|
|
@ -103,13 +103,13 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class[] getInterfaces() {
|
||||
return this.interfaces.toArray(new Class[this.interfaces.size()]);
|
||||
public Class<?>[] getInterfaces() {
|
||||
return this.interfaces.toArray(new Class<?>[this.interfaces.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateInterfaces() throws IllegalArgumentException {
|
||||
for (Class ifc : this.interfaces) {
|
||||
for (Class<?> ifc : this.interfaces) {
|
||||
if (this.advice instanceof DynamicIntroductionAdvice &&
|
||||
!((DynamicIntroductionAdvice) this.advice).implementsInterface(ifc)) {
|
||||
throw new IllegalArgumentException("DynamicIntroductionAdvice [" + this.advice + "] " +
|
||||
|
|
@ -145,7 +145,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,12 +59,12 @@ public class DelegatePerTargetObjectIntroductionInterceptor extends Introduction
|
|||
*/
|
||||
private final Map<Object, Object> delegateMap = new WeakHashMap<Object, Object>();
|
||||
|
||||
private Class defaultImplType;
|
||||
private Class<?> defaultImplType;
|
||||
|
||||
private Class interfaceType;
|
||||
private Class<?> interfaceType;
|
||||
|
||||
|
||||
public DelegatePerTargetObjectIntroductionInterceptor(Class defaultImplType, Class interfaceType) {
|
||||
public DelegatePerTargetObjectIntroductionInterceptor(Class<?> defaultImplType, Class<?> interfaceType) {
|
||||
this.defaultImplType = defaultImplType;
|
||||
this.interfaceType = interfaceType;
|
||||
// cCeate a new delegate now (but don't store it in the map).
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import org.springframework.util.ClassUtils;
|
|||
@SuppressWarnings("serial")
|
||||
public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
|
||||
|
||||
protected final Set<Class> publishedInterfaces = new HashSet<Class>();
|
||||
protected final Set<Class<?>> publishedInterfaces = new HashSet<Class<?>>();
|
||||
|
||||
private transient Map<Method, Boolean> rememberedMethods = new ConcurrentHashMap<Method, Boolean>(32);
|
||||
|
||||
|
|
@ -55,13 +55,13 @@ public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
|
|||
* <p>Does nothing if the interface is not implemented by the delegate.
|
||||
* @param intf the interface to suppress
|
||||
*/
|
||||
public void suppressInterface(Class intf) {
|
||||
public void suppressInterface(Class<?> intf) {
|
||||
this.publishedInterfaces.remove(intf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class[] getInterfaces() {
|
||||
return this.publishedInterfaces.toArray(new Class[this.publishedInterfaces.size()]);
|
||||
public Class<?>[] getInterfaces() {
|
||||
return this.publishedInterfaces.toArray(new Class<?>[this.publishedInterfaces.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,8 +69,8 @@ public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
|
|||
* @param ifc the interface to check
|
||||
* @return whether the interface is part of this introduction
|
||||
*/
|
||||
public boolean implementsInterface(Class ifc) {
|
||||
for (Class pubIfc : this.publishedInterfaces) {
|
||||
public boolean implementsInterface(Class<?> ifc) {
|
||||
for (Class<?> pubIfc : this.publishedInterfaces) {
|
||||
if (ifc.isInterface() && ifc.isAssignableFrom(pubIfc)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public abstract class MethodMatchers {
|
|||
* asking is the subject on one or more introductions; {@code false} otherwise
|
||||
* @return whether or not this method matches statically
|
||||
*/
|
||||
public static boolean matches(MethodMatcher mm, Method method, Class targetClass, boolean hasIntroductions) {
|
||||
public static boolean matches(MethodMatcher mm, Method method, Class<?> targetClass, boolean hasIntroductions) {
|
||||
Assert.notNull(mm, "MethodMatcher must not be null");
|
||||
return ((mm instanceof IntroductionAwareMethodMatcher &&
|
||||
((IntroductionAwareMethodMatcher) mm).matches(method, targetClass, hasIntroductions)) ||
|
||||
|
|
@ -114,22 +114,22 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, boolean hasIntroductions) {
|
||||
public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) {
|
||||
return (matchesClass1(targetClass) && MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions)) ||
|
||||
(matchesClass2(targetClass) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return (matchesClass1(targetClass) && this.mm1.matches(method, targetClass)) ||
|
||||
(matchesClass2(targetClass) && this.mm2.matches(method, targetClass));
|
||||
}
|
||||
|
||||
protected boolean matchesClass1(Class targetClass) {
|
||||
protected boolean matchesClass1(Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean matchesClass2(Class targetClass) {
|
||||
protected boolean matchesClass2(Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, Object[] args) {
|
||||
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
|
||||
return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args);
|
||||
}
|
||||
|
||||
|
|
@ -183,12 +183,12 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean matchesClass1(Class targetClass) {
|
||||
protected boolean matchesClass1(Class<?> targetClass) {
|
||||
return this.cf1.matches(targetClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean matchesClass2(Class targetClass) {
|
||||
protected boolean matchesClass2(Class<?> targetClass) {
|
||||
return this.cf2.matches(targetClass);
|
||||
}
|
||||
|
||||
|
|
@ -230,13 +230,13 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, boolean hasIntroductions) {
|
||||
public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) {
|
||||
return MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions) &&
|
||||
MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return this.mm1.matches(method, targetClass) && this.mm2.matches(method, targetClass);
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass, Object[] args) {
|
||||
public boolean matches(Method method, Class<?> targetClass, Object[] args) {
|
||||
// Because a dynamic intersection may be composed of a static and dynamic part,
|
||||
// we must avoid calling the 3-arg matches method on a dynamic matcher, as
|
||||
// it will probably be an unsupported operation.
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
|
|||
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
for (String mappedName : this.mappedNames) {
|
||||
if (mappedName.equals(method.getName()) || isMatch(method.getName(), mappedName)) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public abstract class Pointcuts {
|
|||
* @param args arguments to the method
|
||||
* @return whether there's a runtime match
|
||||
*/
|
||||
public static boolean matches(Pointcut pointcut, Method method, Class targetClass, Object[] args) {
|
||||
public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object[] args) {
|
||||
Assert.notNull(pointcut, "Pointcut must not be null");
|
||||
if (pointcut == Pointcut.TRUE) {
|
||||
return true;
|
||||
|
|
@ -97,7 +97,7 @@ public abstract class Pointcuts {
|
|||
public static SetterPointcut INSTANCE = new SetterPointcut();
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return method.getName().startsWith("set") &&
|
||||
method.getParameterTypes().length == 1 &&
|
||||
method.getReturnType() == Void.TYPE;
|
||||
|
|
@ -118,7 +118,7 @@ public abstract class Pointcuts {
|
|||
public static GetterPointcut INSTANCE = new GetterPointcut();
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return method.getName().startsWith("get") &&
|
||||
method.getParameterTypes().length == 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,16 +27,16 @@ import org.springframework.aop.ClassFilter;
|
|||
@SuppressWarnings("serial")
|
||||
public class RootClassFilter implements ClassFilter, Serializable {
|
||||
|
||||
private Class clazz;
|
||||
private Class<?> clazz;
|
||||
|
||||
// TODO inheritance
|
||||
|
||||
public RootClassFilter(Class clazz) {
|
||||
public RootClassFilter(Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean matches(Class candidate) {
|
||||
public boolean matches(Class<?> candidate) {
|
||||
return clazz.isAssignableFrom(candidate);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class AnnotationClassFilter implements ClassFilter {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean matches(Class clazz) {
|
||||
public boolean matches(Class<?> clazz) {
|
||||
return (this.checkInherited ?
|
||||
(AnnotationUtils.findAnnotation(clazz, this.annotationType) != null) :
|
||||
clazz.isAnnotationPresent(this.annotationType));
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class AnnotationMethodMatcher extends StaticMethodMatcher {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
if (method.isAnnotationPresent(this.annotationType)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource
|
|||
* <p>Default is to detect the type automatically, through a {@code getType}
|
||||
* call on the BeanFactory (or even a full {@code getBean} call as fallback).
|
||||
*/
|
||||
public void setTargetClass(Class targetClass) {
|
||||
public void setTargetClass(Class<?> targetClass) {
|
||||
this.targetClass = targetClass;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ import org.springframework.beans.factory.DisposableBean;
|
|||
public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBasedTargetSource
|
||||
implements PoolingConfig, DisposableBean {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** The maximum size of the pool */
|
||||
private int maxSize = -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|||
*/
|
||||
public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
super.setBeanFactory(beanFactory);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
|
|||
* @param targetClass the target Class (may be {@code null})
|
||||
* @see #getTargetClass()
|
||||
*/
|
||||
public static EmptyTargetSource forClass(Class targetClass) {
|
||||
public static EmptyTargetSource forClass(Class<?> targetClass) {
|
||||
return forClass(targetClass, true);
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
|
|||
* @param isStatic whether the TargetSource should be marked as static
|
||||
* @see #getTargetClass()
|
||||
*/
|
||||
public static EmptyTargetSource forClass(Class targetClass, boolean isStatic) {
|
||||
public static EmptyTargetSource forClass(Class<?> targetClass, boolean isStatic) {
|
||||
return (targetClass == null && isStatic ? INSTANCE : new EmptyTargetSource(targetClass, isStatic));
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
|
|||
// Instance implementation
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
private final Class targetClass;
|
||||
private final Class<?> targetClass;
|
||||
|
||||
private final boolean isStatic;
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
|
|||
* @param targetClass the target class to expose (may be {@code null})
|
||||
* @param isStatic whether the TargetSource is marked as static
|
||||
*/
|
||||
private EmptyTargetSource(Class targetClass, boolean isStatic) {
|
||||
private EmptyTargetSource(Class<?> targetClass, boolean isStatic) {
|
||||
this.targetClass = targetClass;
|
||||
this.isStatic = isStatic;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ public class NopInterceptor implements MethodInterceptor {
|
|||
++count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof NopInterceptor)) {
|
||||
|
|
@ -57,4 +62,5 @@ public class NopInterceptor implements MethodInterceptor {
|
|||
return this.count == ((NopInterceptor) other).count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,11 @@ import org.springframework.util.ObjectUtils;
|
|||
@SuppressWarnings("serial")
|
||||
public class SerializablePerson implements Person, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
private int age;
|
||||
|
||||
@Override
|
||||
|
|
@ -59,6 +63,11 @@ public class SerializablePerson implements Person, Serializable {
|
|||
return o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof SerializablePerson)) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
|
|||
|
||||
// Redefined with public visibility.
|
||||
@Override
|
||||
public Class getPropertyType(String propertyPath) {
|
||||
public Class<?> getPropertyType(String propertyPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ package org.springframework.beans;
|
|||
@SuppressWarnings("serial")
|
||||
public class BeanInstantiationException extends FatalBeanException {
|
||||
|
||||
private Class beanClass;
|
||||
private Class<?> beanClass;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -34,7 +34,7 @@ public class BeanInstantiationException extends FatalBeanException {
|
|||
* @param beanClass the offending bean class
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public BeanInstantiationException(Class beanClass, String msg) {
|
||||
public BeanInstantiationException(Class<?> beanClass, String msg) {
|
||||
this(beanClass, msg, null);
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ public class BeanInstantiationException extends FatalBeanException {
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause
|
||||
*/
|
||||
public BeanInstantiationException(Class beanClass, String msg, Throwable cause) {
|
||||
public BeanInstantiationException(Class<?> beanClass, String msg, Throwable cause) {
|
||||
super("Could not instantiate bean class [" + beanClass.getName() + "]: " + msg, cause);
|
||||
this.beanClass = beanClass;
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ public class BeanInstantiationException extends FatalBeanException {
|
|||
/**
|
||||
* Return the offending bean class.
|
||||
*/
|
||||
public Class getBeanClass() {
|
||||
public Class<?> getBeanClass() {
|
||||
return beanClass;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ public abstract class BeanUtils {
|
|||
String methodName = signature.substring(0, firstParen);
|
||||
String[] parameterTypeNames =
|
||||
StringUtils.commaDelimitedListToStringArray(signature.substring(firstParen + 1, lastParen));
|
||||
Class<?>[] parameterTypes = new Class[parameterTypeNames.length];
|
||||
Class<?>[] parameterTypes = new Class<?>[parameterTypeNames.length];
|
||||
for (int i = 0; i < parameterTypeNames.length; i++) {
|
||||
String parameterTypeName = parameterTypeNames[i].trim();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor {
|
|||
* @return the type of the wrapped bean instance,
|
||||
* or {@code null} if no wrapped object has been set
|
||||
*/
|
||||
Class getWrappedClass();
|
||||
Class<?> getWrappedClass();
|
||||
|
||||
/**
|
||||
* Obtain the PropertyDescriptors for the wrapped object
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.CollectionFactory;
|
||||
import org.springframework.core.GenericCollectionTypeResolver;
|
||||
import org.springframework.core.convert.ConversionException;
|
||||
|
|
@ -225,7 +224,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
|
||||
@Override
|
||||
public final Class getWrappedClass() {
|
||||
public final Class<?> getWrappedClass() {
|
||||
return (this.object != null ? this.object.getClass() : null);
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +247,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
* Return the class of the root object at the top of the path of this BeanWrapper.
|
||||
* @see #getNestedPath
|
||||
*/
|
||||
public final Class getRootClass() {
|
||||
public final Class<?> getRootClass() {
|
||||
return (this.rootObject != null ? this.rootObject.getClass() : null);
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +309,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
* Needs to be called when the target object changes.
|
||||
* @param clazz the class to introspect
|
||||
*/
|
||||
protected void setIntrospectionClass(Class clazz) {
|
||||
protected void setIntrospectionClass(Class<?> clazz) {
|
||||
if (this.cachedIntrospectionResults != null &&
|
||||
!clazz.equals(this.cachedIntrospectionResults.getBeanClass())) {
|
||||
this.cachedIntrospectionResults = null;
|
||||
|
|
@ -360,7 +359,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getPropertyType(String propertyName) throws BeansException {
|
||||
public Class<?> getPropertyType(String propertyName) throws BeansException {
|
||||
try {
|
||||
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
|
||||
if (pd != null) {
|
||||
|
|
@ -374,7 +373,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
// Check to see if there is a custom editor,
|
||||
// which might give an indication on the desired target type.
|
||||
Class editorType = guessPropertyTypeFromEditors(propertyName);
|
||||
Class<?> editorType = guessPropertyTypeFromEditors(propertyName);
|
||||
if (editorType != null) {
|
||||
return editorType;
|
||||
}
|
||||
|
|
@ -710,7 +709,8 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
return nestedBw.getPropertyValue(tokens);
|
||||
}
|
||||
|
||||
private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
|
||||
String propertyName = tokens.canonicalName;
|
||||
String actualName = tokens.actualName;
|
||||
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
|
||||
|
|
@ -779,20 +779,20 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
else if (value instanceof List) {
|
||||
int index = Integer.parseInt(key);
|
||||
List list = (List) value;
|
||||
List<Object> list = (List<Object>) value;
|
||||
growCollectionIfNecessary(list, index, indexedPropertyName, pd, i + 1);
|
||||
value = list.get(index);
|
||||
}
|
||||
else if (value instanceof Set) {
|
||||
// Apply index to Iterator in case of a Set.
|
||||
Set set = (Set) value;
|
||||
Set<Object> set = (Set<Object>) value;
|
||||
int index = Integer.parseInt(key);
|
||||
if (index < 0 || index >= set.size()) {
|
||||
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
||||
"Cannot get element with index " + index + " from Set of size " +
|
||||
set.size() + ", accessed using property path '" + propertyName + "'");
|
||||
}
|
||||
Iterator it = set.iterator();
|
||||
Iterator<Object> it = set.iterator();
|
||||
for (int j = 0; it.hasNext(); j++) {
|
||||
Object elem = it.next();
|
||||
if (j == index) {
|
||||
|
|
@ -802,7 +802,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
}
|
||||
else if (value instanceof Map) {
|
||||
Map map = (Map) value;
|
||||
Map<Object, Object> map = (Map<Object, Object>) value;
|
||||
Class<?> mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType(pd.getReadMethod(), i + 1);
|
||||
// IMPORTANT: Do not pass full property name in here - property editors
|
||||
// must not kick in for map keys but rather only for map values.
|
||||
|
|
@ -863,16 +863,14 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void growCollectionIfNecessary(
|
||||
Collection collection, int index, String name, PropertyDescriptor pd, int nestingLevel) {
|
||||
|
||||
private void growCollectionIfNecessary(Collection<Object> collection, int index,
|
||||
String name, PropertyDescriptor pd, int nestingLevel) {
|
||||
if (!this.autoGrowNestedPaths) {
|
||||
return;
|
||||
}
|
||||
int size = collection.size();
|
||||
if (index >= size && index < this.autoGrowCollectionLimit) {
|
||||
Class elementType = GenericCollectionTypeResolver.getCollectionReturnType(pd.getReadMethod(), nestingLevel);
|
||||
Class<?> elementType = GenericCollectionTypeResolver.getCollectionReturnType(pd.getReadMethod(), nestingLevel);
|
||||
if (elementType != null) {
|
||||
for (int i = collection.size(); i < index + 1; i++) {
|
||||
collection.add(newValue(elementType, name));
|
||||
|
|
@ -958,7 +956,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
if (propValue.getClass().isArray()) {
|
||||
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
|
||||
Class requiredType = propValue.getClass().getComponentType();
|
||||
Class<?> requiredType = propValue.getClass().getComponentType();
|
||||
int arrayIndex = Integer.parseInt(key);
|
||||
Object oldValue = null;
|
||||
try {
|
||||
|
|
@ -976,9 +974,9 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
else if (propValue instanceof List) {
|
||||
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
|
||||
Class requiredType = GenericCollectionTypeResolver.getCollectionReturnType(
|
||||
Class<?> requiredType = GenericCollectionTypeResolver.getCollectionReturnType(
|
||||
pd.getReadMethod(), tokens.keys.length);
|
||||
List list = (List) propValue;
|
||||
List<Object> list = (List<Object>) propValue;
|
||||
int index = Integer.parseInt(key);
|
||||
Object oldValue = null;
|
||||
if (isExtractOldValueForEditor() && index < list.size()) {
|
||||
|
|
@ -1013,11 +1011,11 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
}
|
||||
else if (propValue instanceof Map) {
|
||||
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
|
||||
Class mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType(
|
||||
Class<?> mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType(
|
||||
pd.getReadMethod(), tokens.keys.length);
|
||||
Class mapValueType = GenericCollectionTypeResolver.getMapValueReturnType(
|
||||
Class<?> mapValueType = GenericCollectionTypeResolver.getMapValueReturnType(
|
||||
pd.getReadMethod(), tokens.keys.length);
|
||||
Map map = (Map) propValue;
|
||||
Map<Object, Object> map = (Map<Object, Object>) propValue;
|
||||
// IMPORTANT: Do not pass full property name in here - property editors
|
||||
// must not kick in for map keys but rather only for map values.
|
||||
TypeDescriptor typeDescriptor = (mapKeyType != null ?
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import java.util.WeakHashMap;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
|
@ -76,7 +75,7 @@ public class CachedIntrospectionResults {
|
|||
* Needs to be a WeakHashMap with WeakReferences as values to allow
|
||||
* for proper garbage collection in case of multiple class loaders.
|
||||
*/
|
||||
static final Map<Class, Object> classCache = new WeakHashMap<Class, Object>();
|
||||
static final Map<Class<?>, Object> classCache = new WeakHashMap<Class<?>, Object>();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -107,7 +106,7 @@ public class CachedIntrospectionResults {
|
|||
*/
|
||||
public static void clearClassLoader(ClassLoader classLoader) {
|
||||
synchronized (classCache) {
|
||||
for (Iterator<Class> it = classCache.keySet().iterator(); it.hasNext();) {
|
||||
for (Iterator<Class<?>> it = classCache.keySet().iterator(); it.hasNext();) {
|
||||
Class<?> beanClass = it.next();
|
||||
if (isUnderneathClassLoader(beanClass.getClassLoader(), classLoader)) {
|
||||
it.remove();
|
||||
|
|
@ -130,6 +129,7 @@ public class CachedIntrospectionResults {
|
|||
* @return the corresponding CachedIntrospectionResults
|
||||
* @throws BeansException in case of introspection failure
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
static CachedIntrospectionResults forClass(Class<?> beanClass) throws BeansException {
|
||||
CachedIntrospectionResults results;
|
||||
Object value;
|
||||
|
|
@ -137,8 +137,8 @@ public class CachedIntrospectionResults {
|
|||
value = classCache.get(beanClass);
|
||||
}
|
||||
if (value instanceof Reference) {
|
||||
Reference ref = (Reference) value;
|
||||
results = (CachedIntrospectionResults) ref.get();
|
||||
Reference<CachedIntrospectionResults> ref = (Reference<CachedIntrospectionResults>) value;
|
||||
results = ref.get();
|
||||
}
|
||||
else {
|
||||
results = (CachedIntrospectionResults) value;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ public class ConversionNotSupportedException extends TypeMismatchException {
|
|||
* @param requiredType the required target type (or {@code null} if not known)
|
||||
* @param cause the root cause (may be {@code null})
|
||||
*/
|
||||
public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent, Class requiredType, Throwable cause) {
|
||||
public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent,
|
||||
Class<?> requiredType, Throwable cause) {
|
||||
super(propertyChangeEvent, requiredType, cause);
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ public class ConversionNotSupportedException extends TypeMismatchException {
|
|||
* @param requiredType the required target type (or {@code null} if not known)
|
||||
* @param cause the root cause (may be {@code null})
|
||||
*/
|
||||
public ConversionNotSupportedException(Object value, Class requiredType, Throwable cause) {
|
||||
public ConversionNotSupportedException(Object value, Class<?> requiredType, Throwable cause) {
|
||||
super(value, requiredType, cause);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ package org.springframework.beans;
|
|||
@SuppressWarnings("serial")
|
||||
public class InvalidPropertyException extends FatalBeanException {
|
||||
|
||||
private Class beanClass;
|
||||
private Class<?> beanClass;
|
||||
|
||||
private String propertyName;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ public class InvalidPropertyException extends FatalBeanException {
|
|||
* @param propertyName the offending property
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public InvalidPropertyException(Class beanClass, String propertyName, String msg) {
|
||||
public InvalidPropertyException(Class<?> beanClass, String propertyName, String msg) {
|
||||
this(beanClass, propertyName, msg, null);
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ public class InvalidPropertyException extends FatalBeanException {
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause
|
||||
*/
|
||||
public InvalidPropertyException(Class beanClass, String propertyName, String msg, Throwable cause) {
|
||||
public InvalidPropertyException(Class<?> beanClass, String propertyName, String msg, Throwable cause) {
|
||||
super("Invalid property '" + propertyName + "' of bean class [" + beanClass.getName() + "]: " + msg, cause);
|
||||
this.beanClass = beanClass;
|
||||
this.propertyName = propertyName;
|
||||
|
|
@ -57,7 +57,7 @@ public class InvalidPropertyException extends FatalBeanException {
|
|||
/**
|
||||
* Return the offending bean class.
|
||||
*/
|
||||
public Class getBeanClass() {
|
||||
public Class<?> getBeanClass() {
|
||||
return beanClass;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
|||
// There is no replacement of existing property values.
|
||||
if (original != null) {
|
||||
this.propertyValueList = new ArrayList<PropertyValue>(original.size());
|
||||
for (Map.Entry entry : original.entrySet()) {
|
||||
for (Map.Entry<?, ?> entry : original.entrySet()) {
|
||||
this.propertyValueList.add(new PropertyValue(entry.getKey().toString(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class NotReadablePropertyException extends InvalidPropertyException {
|
|||
* @param beanClass the offending bean class
|
||||
* @param propertyName the offending property
|
||||
*/
|
||||
public NotReadablePropertyException(Class beanClass, String propertyName) {
|
||||
public NotReadablePropertyException(Class<?> beanClass, String propertyName) {
|
||||
super(beanClass, propertyName,
|
||||
"Bean property '" + propertyName + "' is not readable or has an invalid getter method: " +
|
||||
"Does the return type of the getter match the parameter type of the setter?");
|
||||
|
|
@ -43,7 +43,7 @@ public class NotReadablePropertyException extends InvalidPropertyException {
|
|||
* @param propertyName the offending property
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public NotReadablePropertyException(Class beanClass, String propertyName, String msg) {
|
||||
public NotReadablePropertyException(Class<?> beanClass, String propertyName, String msg) {
|
||||
super(beanClass, propertyName, msg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
|
|||
* @param beanClass the offending bean class
|
||||
* @param propertyName the offending property name
|
||||
*/
|
||||
public NotWritablePropertyException(Class beanClass, String propertyName) {
|
||||
public NotWritablePropertyException(Class<?> beanClass, String propertyName) {
|
||||
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?");
|
||||
|
|
@ -47,7 +47,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
|
|||
* @param propertyName the offending property name
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public NotWritablePropertyException(Class beanClass, String propertyName, String msg) {
|
||||
public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg) {
|
||||
super(beanClass, propertyName, msg);
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ public class NotWritablePropertyException extends InvalidPropertyException {
|
|||
* @param possibleMatches suggestions for actual bean property names
|
||||
* that closely match the invalid property name
|
||||
*/
|
||||
public NotWritablePropertyException(Class beanClass, String propertyName, String msg, String[] possibleMatches) {
|
||||
public NotWritablePropertyException(Class<?> beanClass, String propertyName, String msg, String[] possibleMatches) {
|
||||
super(beanClass, propertyName, msg);
|
||||
this.possibleMatches = possibleMatches;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class NullValueInNestedPathException extends InvalidPropertyException {
|
|||
* @param beanClass the offending bean class
|
||||
* @param propertyName the offending property
|
||||
*/
|
||||
public NullValueInNestedPathException(Class beanClass, String propertyName) {
|
||||
public NullValueInNestedPathException(Class<?> beanClass, String propertyName) {
|
||||
super(beanClass, propertyName, "Value of nested property '" + propertyName + "' is null");
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ public class NullValueInNestedPathException extends InvalidPropertyException {
|
|||
* @param propertyName the offending property
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public NullValueInNestedPathException(Class beanClass, String propertyName, String msg) {
|
||||
public NullValueInNestedPathException(Class<?> beanClass, String propertyName, String msg) {
|
||||
super(beanClass, propertyName, msg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public interface PropertyAccessor {
|
|||
* @throws PropertyAccessException if the property was valid but the
|
||||
* accessor method failed
|
||||
*/
|
||||
Class getPropertyType(String propertyName) throws BeansException;
|
||||
Class<?> getPropertyType(String propertyName) throws BeansException;
|
||||
|
||||
/**
|
||||
* Return a type descriptor for the specified property:
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class PropertyBatchUpdateException extends BeansException {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Class exType) {
|
||||
public boolean contains(Class<?> exType) {
|
||||
if (exType == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ final class PropertyMatches {
|
|||
* @param propertyName the name of the property to find possible matches for
|
||||
* @param beanClass the bean class to search for matches
|
||||
*/
|
||||
public static PropertyMatches forProperty(String propertyName, Class beanClass) {
|
||||
public static PropertyMatches forProperty(String propertyName, Class<?> beanClass) {
|
||||
return forProperty(propertyName, beanClass, DEFAULT_MAX_DISTANCE);
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ final class PropertyMatches {
|
|||
* @param beanClass the bean class to search for matches
|
||||
* @param maxDistance the maximum property distance allowed for matches
|
||||
*/
|
||||
public static PropertyMatches forProperty(String propertyName, Class beanClass, int maxDistance) {
|
||||
public static PropertyMatches forProperty(String propertyName, Class<?> beanClass, int maxDistance) {
|
||||
return new PropertyMatches(propertyName, beanClass, maxDistance);
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ final class PropertyMatches {
|
|||
/**
|
||||
* Create a new PropertyMatches instance for the given property.
|
||||
*/
|
||||
private PropertyMatches(String propertyName, Class beanClass, int maxDistance) {
|
||||
private PropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) {
|
||||
this.propertyName = propertyName;
|
||||
this.possibleMatches = calculateMatches(BeanUtils.getPropertyDescriptors(beanClass), maxDistance);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,13 +200,13 @@ class TypeConverterDelegate {
|
|||
else if (convertedValue instanceof Collection) {
|
||||
// Convert elements to target type, if determined.
|
||||
convertedValue = convertToTypedCollection(
|
||||
(Collection) convertedValue, propertyName, requiredType, typeDescriptor);
|
||||
(Collection<?>) convertedValue, propertyName, requiredType, typeDescriptor);
|
||||
standardConversion = true;
|
||||
}
|
||||
else if (convertedValue instanceof Map) {
|
||||
// Convert keys and values to respective target type, if determined.
|
||||
convertedValue = convertToTypedMap(
|
||||
(Map) convertedValue, propertyName, requiredType, typeDescriptor);
|
||||
(Map<?, ?>) convertedValue, propertyName, requiredType, typeDescriptor);
|
||||
standardConversion = true;
|
||||
}
|
||||
if (convertedValue.getClass().isArray() && Array.getLength(convertedValue) == 1) {
|
||||
|
|
@ -220,8 +220,8 @@ class TypeConverterDelegate {
|
|||
else if (convertedValue instanceof String && !requiredType.isInstance(convertedValue)) {
|
||||
if (firstAttemptEx == null && !requiredType.isInterface() && !requiredType.isEnum()) {
|
||||
try {
|
||||
Constructor strCtor = requiredType.getConstructor(String.class);
|
||||
return (T) BeanUtils.instantiateClass(strCtor, convertedValue);
|
||||
Constructor<T> strCtor = requiredType.getConstructor(String.class);
|
||||
return BeanUtils.instantiateClass(strCtor, convertedValue);
|
||||
}
|
||||
catch (NoSuchMethodException ex) {
|
||||
// proceed with field lookup
|
||||
|
|
@ -331,7 +331,7 @@ class TypeConverterDelegate {
|
|||
* @param requiredType the type to find an editor for
|
||||
* @return the corresponding editor, or {@code null} if none
|
||||
*/
|
||||
private PropertyEditor findDefaultEditor(Class requiredType) {
|
||||
private PropertyEditor findDefaultEditor(Class<?> requiredType) {
|
||||
PropertyEditor editor = null;
|
||||
if (requiredType != null) {
|
||||
// No custom editor -> check BeanWrapperImpl's default editors.
|
||||
|
|
@ -434,10 +434,10 @@ class TypeConverterDelegate {
|
|||
private Object convertToTypedArray(Object input, String propertyName, Class<?> componentType) {
|
||||
if (input instanceof Collection) {
|
||||
// Convert Collection elements to array elements.
|
||||
Collection coll = (Collection) input;
|
||||
Collection<?> coll = (Collection<?>) input;
|
||||
Object result = Array.newInstance(componentType, coll.size());
|
||||
int i = 0;
|
||||
for (Iterator it = coll.iterator(); it.hasNext(); i++) {
|
||||
for (Iterator<?> it = coll.iterator(); it.hasNext(); i++) {
|
||||
Object value = convertIfNecessary(
|
||||
buildIndexedPropertyName(propertyName, i), null, it.next(), componentType);
|
||||
Array.set(result, i, value);
|
||||
|
|
@ -470,8 +470,8 @@ class TypeConverterDelegate {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Collection convertToTypedCollection(
|
||||
Collection original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
|
||||
private Collection<?> convertToTypedCollection(
|
||||
Collection<?> original, String propertyName, Class<?> requiredType, TypeDescriptor typeDescriptor) {
|
||||
|
||||
if (!Collection.class.isAssignableFrom(requiredType)) {
|
||||
return original;
|
||||
|
|
@ -494,7 +494,7 @@ class TypeConverterDelegate {
|
|||
return original;
|
||||
}
|
||||
|
||||
Iterator it;
|
||||
Iterator<?> it;
|
||||
try {
|
||||
it = original.iterator();
|
||||
if (it == null) {
|
||||
|
|
@ -513,13 +513,13 @@ class TypeConverterDelegate {
|
|||
return original;
|
||||
}
|
||||
|
||||
Collection convertedCopy;
|
||||
Collection<Object> convertedCopy;
|
||||
try {
|
||||
if (approximable) {
|
||||
convertedCopy = CollectionFactory.createApproximateCollection(original, original.size());
|
||||
}
|
||||
else {
|
||||
convertedCopy = (Collection) requiredType.newInstance();
|
||||
convertedCopy = (Collection<Object>) requiredType.newInstance();
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
|
|
@ -552,8 +552,8 @@ class TypeConverterDelegate {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map convertToTypedMap(
|
||||
Map original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
|
||||
private Map<?, ?> convertToTypedMap(
|
||||
Map<?, ?> original, String propertyName, Class<?> requiredType, TypeDescriptor typeDescriptor) {
|
||||
|
||||
if (!Map.class.isAssignableFrom(requiredType)) {
|
||||
return original;
|
||||
|
|
@ -577,7 +577,7 @@ class TypeConverterDelegate {
|
|||
return original;
|
||||
}
|
||||
|
||||
Iterator it;
|
||||
Iterator<?> it;
|
||||
try {
|
||||
it = original.entrySet().iterator();
|
||||
if (it == null) {
|
||||
|
|
@ -596,13 +596,13 @@ class TypeConverterDelegate {
|
|||
return original;
|
||||
}
|
||||
|
||||
Map convertedCopy;
|
||||
Map<Object, Object> convertedCopy;
|
||||
try {
|
||||
if (approximable) {
|
||||
convertedCopy = CollectionFactory.createApproximateMap(original, original.size());
|
||||
}
|
||||
else {
|
||||
convertedCopy = (Map) requiredType.newInstance();
|
||||
convertedCopy = (Map<Object, Object>) requiredType.newInstance();
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
|
|
@ -614,7 +614,7 @@ class TypeConverterDelegate {
|
|||
}
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) it.next();
|
||||
Object key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
String keyedPropertyName = buildKeyedPropertyName(propertyName, key);
|
||||
|
|
@ -649,7 +649,7 @@ class TypeConverterDelegate {
|
|||
null);
|
||||
}
|
||||
|
||||
private boolean canCreateCopy(Class requiredType) {
|
||||
private boolean canCreateCopy(Class<?> requiredType) {
|
||||
return (!requiredType.isInterface() && !Modifier.isAbstract(requiredType.getModifiers()) &&
|
||||
Modifier.isPublic(requiredType.getModifiers()) && ClassUtils.hasConstructor(requiredType));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class TypeMismatchException extends PropertyAccessException {
|
|||
|
||||
private transient Object value;
|
||||
|
||||
private Class requiredType;
|
||||
private Class<?> requiredType;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +45,7 @@ public class TypeMismatchException extends PropertyAccessException {
|
|||
* @param propertyChangeEvent the PropertyChangeEvent that resulted in the problem
|
||||
* @param requiredType the required target type
|
||||
*/
|
||||
public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requiredType) {
|
||||
public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class<?> requiredType) {
|
||||
this(propertyChangeEvent, requiredType, null);
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ public class TypeMismatchException extends PropertyAccessException {
|
|||
* @param requiredType the required target type (or {@code null} if not known)
|
||||
* @param cause the root cause (may be {@code null})
|
||||
*/
|
||||
public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requiredType, Throwable cause) {
|
||||
public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class<?> requiredType, Throwable cause) {
|
||||
super(propertyChangeEvent,
|
||||
"Failed to convert property value of type '" +
|
||||
ClassUtils.getDescriptiveType(propertyChangeEvent.getNewValue()) + "'" +
|
||||
|
|
@ -73,7 +73,7 @@ public class TypeMismatchException extends PropertyAccessException {
|
|||
* @param value the offending value that couldn't be converted (may be {@code null})
|
||||
* @param requiredType the required target type (or {@code null} if not known)
|
||||
*/
|
||||
public TypeMismatchException(Object value, Class requiredType) {
|
||||
public TypeMismatchException(Object value, Class<?> requiredType) {
|
||||
this(value, requiredType, null);
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ public class TypeMismatchException extends PropertyAccessException {
|
|||
* @param requiredType the required target type (or {@code null} if not known)
|
||||
* @param cause the root cause (may be {@code null})
|
||||
*/
|
||||
public TypeMismatchException(Object value, Class requiredType, Throwable cause) {
|
||||
public TypeMismatchException(Object value, Class<?> requiredType, Throwable cause) {
|
||||
super("Failed to convert value of type '" + ClassUtils.getDescriptiveType(value) + "'" +
|
||||
(requiredType != null ? " to required type '" + ClassUtils.getQualifiedName(requiredType) + "'" : ""),
|
||||
cause);
|
||||
|
|
@ -103,7 +103,7 @@ public class TypeMismatchException extends PropertyAccessException {
|
|||
/**
|
||||
* Return the required target type, if any.
|
||||
*/
|
||||
public Class getRequiredType() {
|
||||
public Class<?> getRequiredType() {
|
||||
return this.requiredType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public class BeanCreationException extends FatalBeanException {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Class exClass) {
|
||||
public boolean contains(Class<?> exClass) {
|
||||
if (super.contains(exClass)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class BeanIsNotAFactoryException extends BeanNotOfRequiredTypeException {
|
|||
* @param actualType the actual type returned, which did not match
|
||||
* the expected type
|
||||
*/
|
||||
public BeanIsNotAFactoryException(String name, Class actualType) {
|
||||
public BeanIsNotAFactoryException(String name, Class<?> actualType) {
|
||||
super(name, FactoryBean.class, actualType);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ public class BeanNotOfRequiredTypeException extends BeansException {
|
|||
private String beanName;
|
||||
|
||||
/** The required type */
|
||||
private Class requiredType;
|
||||
private Class<?> requiredType;
|
||||
|
||||
/** The offending type */
|
||||
private Class actualType;
|
||||
private Class<?> actualType;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +44,7 @@ public class BeanNotOfRequiredTypeException extends BeansException {
|
|||
* @param actualType the actual type returned, which did not match
|
||||
* the expected type
|
||||
*/
|
||||
public BeanNotOfRequiredTypeException(String beanName, Class requiredType, Class actualType) {
|
||||
public BeanNotOfRequiredTypeException(String beanName, Class<?> requiredType, Class<?> actualType) {
|
||||
super("Bean named '" + beanName + "' must be of type [" + requiredType.getName() +
|
||||
"], but was actually of type [" + actualType.getName() + "]");
|
||||
this.beanName = beanName;
|
||||
|
|
@ -63,14 +63,14 @@ public class BeanNotOfRequiredTypeException extends BeansException {
|
|||
/**
|
||||
* Return the expected type for the bean.
|
||||
*/
|
||||
public Class getRequiredType() {
|
||||
public Class<?> getRequiredType() {
|
||||
return this.requiredType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual type of the instance found.
|
||||
*/
|
||||
public Class getActualType() {
|
||||
public Class<?> getActualType() {
|
||||
return this.actualType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
|
|||
* @param msg the detail message
|
||||
*/
|
||||
public UnsatisfiedDependencyException(
|
||||
String resourceDescription, String beanName, int ctorArgIndex, Class ctorArgType, String msg) {
|
||||
String resourceDescription, String beanName, int ctorArgIndex, Class<?> ctorArgType, String msg) {
|
||||
|
||||
super(resourceDescription, beanName,
|
||||
"Unsatisfied dependency expressed through constructor argument with index " +
|
||||
|
|
@ -86,7 +86,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
|
|||
* @param ex the bean creation exception that indicated the unsatisfied dependency
|
||||
*/
|
||||
public UnsatisfiedDependencyException(
|
||||
String resourceDescription, String beanName, int ctorArgIndex, Class ctorArgType, BeansException ex) {
|
||||
String resourceDescription, String beanName, int ctorArgIndex, Class<?> ctorArgType, BeansException ex) {
|
||||
|
||||
this(resourceDescription, beanName, ctorArgIndex, ctorArgType, (ex != null ? ": " + ex.getMessage() : ""));
|
||||
initCause(ex);
|
||||
|
|
|
|||
|
|
@ -268,10 +268,10 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
|||
if (requiredConstructor == null && defaultConstructor != null) {
|
||||
candidates.add(defaultConstructor);
|
||||
}
|
||||
candidateConstructors = candidates.toArray(new Constructor[candidates.size()]);
|
||||
candidateConstructors = candidates.toArray(new Constructor<?>[candidates.size()]);
|
||||
}
|
||||
else {
|
||||
candidateConstructors = new Constructor[0];
|
||||
candidateConstructors = new Constructor<?>[0];
|
||||
}
|
||||
this.candidateConstructorsCache.put(beanClass, candidateConstructors);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class CustomAutowireConfigurer implements BeanFactoryPostProcessor, BeanC
|
|||
|
||||
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
|
||||
|
||||
private Set customQualifierTypes;
|
||||
private Set<?> customQualifierTypes;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public class CustomAutowireConfigurer implements BeanFactoryPostProcessor, BeanC
|
|||
* does not require explicit registration.
|
||||
* @param customQualifierTypes the custom types to register
|
||||
*/
|
||||
public void setCustomQualifierTypes(Set customQualifierTypes) {
|
||||
public void setCustomQualifierTypes(Set<?> customQualifierTypes) {
|
||||
this.customQualifierTypes = customQualifierTypes;
|
||||
}
|
||||
|
||||
|
|
@ -99,13 +99,13 @@ public class CustomAutowireConfigurer implements BeanFactoryPostProcessor, BeanC
|
|||
QualifierAnnotationAutowireCandidateResolver resolver =
|
||||
(QualifierAnnotationAutowireCandidateResolver) dlbf.getAutowireCandidateResolver();
|
||||
for (Object value : this.customQualifierTypes) {
|
||||
Class customType = null;
|
||||
Class<? extends Annotation> customType = null;
|
||||
if (value instanceof Class) {
|
||||
customType = (Class) value;
|
||||
customType = (Class<? extends Annotation>) value;
|
||||
}
|
||||
else if (value instanceof String) {
|
||||
String className = (String) value;
|
||||
customType = ClassUtils.resolveClassName(className, this.beanClassLoader);
|
||||
customType = (Class<? extends Annotation>) ClassUtils.resolveClassName(className, this.beanClassLoader);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException(
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ public class InitDestroyAnnotationBeanPostProcessor
|
|||
*/
|
||||
private class LifecycleMetadata {
|
||||
|
||||
private final Class targetClass;
|
||||
private final Class<?> targetClass;
|
||||
|
||||
private final Collection<LifecycleElement> initMethods;
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public abstract class AbstractFactoryBean<T>
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private T getEarlySingletonInstance() throws Exception {
|
||||
Class[] ifcs = getEarlySingletonInterfaces();
|
||||
Class<?>[] ifcs = getEarlySingletonInterfaces();
|
||||
if (ifcs == null) {
|
||||
throw new FactoryBeanNotInitializedException(
|
||||
getClass().getName() + " does not support circular references");
|
||||
|
|
@ -225,9 +225,9 @@ public abstract class AbstractFactoryBean<T>
|
|||
* or {@code null} to indicate a FactoryBeanNotInitializedException
|
||||
* @see org.springframework.beans.factory.FactoryBeanNotInitializedException
|
||||
*/
|
||||
protected Class[] getEarlySingletonInterfaces() {
|
||||
Class type = getObjectType();
|
||||
return (type != null && type.isInterface() ? new Class[] {type} : null);
|
||||
protected Class<?>[] getEarlySingletonInterfaces() {
|
||||
Class<?> type = getObjectType();
|
||||
return (type != null && type.isInterface() ? new Class<?>[] {type} : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import org.springframework.beans.factory.SmartFactoryBean;
|
|||
* (which support placeholder parsing since Spring 2.5)
|
||||
*/
|
||||
@Deprecated
|
||||
public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAware {
|
||||
public class BeanReferenceFactoryBean implements SmartFactoryBean<Object>, BeanFactoryAware {
|
||||
|
||||
private String targetBeanName;
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAw
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getObjectType() {
|
||||
public Class<?> getObjectType() {
|
||||
if (this.beanFactory == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,6 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, Ordered
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
if (this.propertyEditorRegistrars != null) {
|
||||
for (PropertyEditorRegistrar propertyEditorRegistrar : this.propertyEditorRegistrars) {
|
||||
|
|
@ -149,7 +148,7 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, Ordered
|
|||
}
|
||||
if (this.customEditors != null) {
|
||||
for (Map.Entry<Class<?>, Class<? extends PropertyEditor>> entry : this.customEditors.entrySet()) {
|
||||
Class requiredType = entry.getKey();
|
||||
Class<?> requiredType = entry.getKey();
|
||||
Class<? extends PropertyEditor> propertyEditorClass = entry.getValue();
|
||||
beanFactory.registerCustomEditor(requiredType, propertyEditorClass);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
if (this.scopes != null) {
|
||||
for (Map.Entry<String, Object> entry : this.scopes.entrySet()) {
|
||||
|
|
@ -87,12 +86,12 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
|
|||
beanFactory.registerScope(scopeKey, (Scope) value);
|
||||
}
|
||||
else if (value instanceof Class) {
|
||||
Class scopeClass = (Class) value;
|
||||
Class<?> scopeClass = (Class<?>) value;
|
||||
Assert.isAssignable(Scope.class, scopeClass);
|
||||
beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClass(scopeClass));
|
||||
}
|
||||
else if (value instanceof String) {
|
||||
Class scopeClass = ClassUtils.resolveClassName((String) value, this.beanClassLoader);
|
||||
Class<?> scopeClass = ClassUtils.resolveClassName((String) value, this.beanClassLoader);
|
||||
Assert.isAssignable(Scope.class, scopeClass);
|
||||
beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClass(scopeClass));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class DependencyDescriptor implements Serializable {
|
|||
|
||||
private String methodName;
|
||||
|
||||
private Class[] parameterTypes;
|
||||
private Class<?>[] parameterTypes;
|
||||
|
||||
private int parameterIndex;
|
||||
|
||||
|
|
@ -267,12 +267,12 @@ public class DependencyDescriptor implements Serializable {
|
|||
Type[] args = ((ParameterizedType) type).getActualTypeArguments();
|
||||
Type arg = args[args.length - 1];
|
||||
if (arg instanceof Class) {
|
||||
return (Class) arg;
|
||||
return (Class<?>) arg;
|
||||
}
|
||||
else if (arg instanceof ParameterizedType) {
|
||||
arg = ((ParameterizedType) arg).getRawType();
|
||||
if (arg instanceof Class) {
|
||||
return (Class) arg;
|
||||
return (Class<?>) arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ import org.springframework.util.StringUtils;
|
|||
public class FieldRetrievingFactoryBean
|
||||
implements FactoryBean<Object>, BeanNameAware, BeanClassLoaderAware, InitializingBean {
|
||||
|
||||
private Class targetClass;
|
||||
private Class<?> targetClass;
|
||||
|
||||
private Object targetObject;
|
||||
|
||||
|
|
@ -78,14 +78,14 @@ public class FieldRetrievingFactoryBean
|
|||
* @see #setTargetObject
|
||||
* @see #setTargetField
|
||||
*/
|
||||
public void setTargetClass(Class targetClass) {
|
||||
public void setTargetClass(Class<?> targetClass) {
|
||||
this.targetClass = targetClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the target class on which the field is defined.
|
||||
*/
|
||||
public Class getTargetClass() {
|
||||
public Class<?> getTargetClass() {
|
||||
return targetClass;
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ public class FieldRetrievingFactoryBean
|
|||
}
|
||||
|
||||
// Try to get the exact method first.
|
||||
Class targetClass = (this.targetObject != null) ? this.targetObject.getClass() : this.targetClass;
|
||||
Class<?> targetClass = (this.targetObject != null) ? this.targetObject.getClass() : this.targetClass;
|
||||
this.fieldObject = targetClass.getField(this.targetField);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,17 +32,18 @@ import org.springframework.core.GenericCollectionTypeResolver;
|
|||
* @see SetFactoryBean
|
||||
* @see MapFactoryBean
|
||||
*/
|
||||
public class ListFactoryBean extends AbstractFactoryBean<List> {
|
||||
public class ListFactoryBean extends AbstractFactoryBean<List<Object>> {
|
||||
|
||||
private List sourceList;
|
||||
private List<?> sourceList;
|
||||
|
||||
private Class targetListClass;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Class<? extends List> targetListClass;
|
||||
|
||||
|
||||
/**
|
||||
* Set the source List, typically populated via XML "list" elements.
|
||||
*/
|
||||
public void setSourceList(List sourceList) {
|
||||
public void setSourceList(List<?> sourceList) {
|
||||
this.sourceList = sourceList;
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +53,8 @@ public class ListFactoryBean extends AbstractFactoryBean<List> {
|
|||
* <p>Default is a {@code java.util.ArrayList}.
|
||||
* @see java.util.ArrayList
|
||||
*/
|
||||
public void setTargetListClass(Class targetListClass) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setTargetListClass(Class<? extends List> targetListClass) {
|
||||
if (targetListClass == null) {
|
||||
throw new IllegalArgumentException("'targetListClass' must not be null");
|
||||
}
|
||||
|
|
@ -64,24 +66,25 @@ public class ListFactoryBean extends AbstractFactoryBean<List> {
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Class<List> getObjectType() {
|
||||
return List.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected List createInstance() {
|
||||
protected List<Object> createInstance() {
|
||||
if (this.sourceList == null) {
|
||||
throw new IllegalArgumentException("'sourceList' is required");
|
||||
}
|
||||
List result = null;
|
||||
List<Object> result = null;
|
||||
if (this.targetListClass != null) {
|
||||
result = (List) BeanUtils.instantiateClass(this.targetListClass);
|
||||
result = BeanUtils.instantiateClass(this.targetListClass);
|
||||
}
|
||||
else {
|
||||
result = new ArrayList(this.sourceList.size());
|
||||
result = new ArrayList<Object>(this.sourceList.size());
|
||||
}
|
||||
Class valueType = null;
|
||||
Class<?> valueType = null;
|
||||
if (this.targetListClass != null) {
|
||||
valueType = GenericCollectionTypeResolver.getCollectionType(this.targetListClass);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,17 +32,18 @@ import org.springframework.core.GenericCollectionTypeResolver;
|
|||
* @see SetFactoryBean
|
||||
* @see ListFactoryBean
|
||||
*/
|
||||
public class MapFactoryBean extends AbstractFactoryBean<Map> {
|
||||
public class MapFactoryBean extends AbstractFactoryBean<Map<Object, Object>> {
|
||||
|
||||
private Map<?, ?> sourceMap;
|
||||
|
||||
private Class targetMapClass;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Class<? extends Map> targetMapClass;
|
||||
|
||||
|
||||
/**
|
||||
* Set the source Map, typically populated via XML "map" elements.
|
||||
*/
|
||||
public void setSourceMap(Map sourceMap) {
|
||||
public void setSourceMap(Map<?, ?> sourceMap) {
|
||||
this.sourceMap = sourceMap;
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +53,8 @@ public class MapFactoryBean extends AbstractFactoryBean<Map> {
|
|||
* <p>Default is a linked HashMap, keeping the registration order.
|
||||
* @see java.util.LinkedHashMap
|
||||
*/
|
||||
public void setTargetMapClass(Class targetMapClass) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setTargetMapClass(Class<? extends Map> targetMapClass) {
|
||||
if (targetMapClass == null) {
|
||||
throw new IllegalArgumentException("'targetMapClass' must not be null");
|
||||
}
|
||||
|
|
@ -64,32 +66,33 @@ public class MapFactoryBean extends AbstractFactoryBean<Map> {
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Class<Map> getObjectType() {
|
||||
return Map.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map createInstance() {
|
||||
protected Map<Object, Object> createInstance() {
|
||||
if (this.sourceMap == null) {
|
||||
throw new IllegalArgumentException("'sourceMap' is required");
|
||||
}
|
||||
Map result = null;
|
||||
Map<Object, Object> result = null;
|
||||
if (this.targetMapClass != null) {
|
||||
result = (Map) BeanUtils.instantiateClass(this.targetMapClass);
|
||||
result = BeanUtils.instantiateClass(this.targetMapClass);
|
||||
}
|
||||
else {
|
||||
result = new LinkedHashMap(this.sourceMap.size());
|
||||
result = new LinkedHashMap<Object, Object>(this.sourceMap.size());
|
||||
}
|
||||
Class keyType = null;
|
||||
Class valueType = null;
|
||||
Class<?> keyType = null;
|
||||
Class<?> valueType = null;
|
||||
if (this.targetMapClass != null) {
|
||||
keyType = GenericCollectionTypeResolver.getMapKeyType(this.targetMapClass);
|
||||
valueType = GenericCollectionTypeResolver.getMapValueType(this.targetMapClass);
|
||||
}
|
||||
if (keyType != null || valueType != null) {
|
||||
TypeConverter converter = getBeanTypeConverter();
|
||||
for (Map.Entry entry : this.sourceMap.entrySet()) {
|
||||
for (Map.Entry<?, ?> entry : this.sourceMap.entrySet()) {
|
||||
Object convertedKey = converter.convertIfNecessary(entry.getKey(), keyType);
|
||||
Object convertedValue = converter.convertIfNecessary(entry.getValue(), valueType);
|
||||
result.put(convertedKey, convertedValue);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue