, Object>();
private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory();
@@ -75,7 +75,7 @@ public AspectJProxyFactory(Object target) {
* Create a new AspectJProxyFactory.
* No target, only interfaces. Must add interceptors.
*/
- public AspectJProxyFactory(Class[] interfaces) {
+ public AspectJProxyFactory(Class>[] interfaces) {
setInterfaces(interfaces);
}
@@ -88,7 +88,7 @@ public AspectJProxyFactory(Class[] interfaces) {
* @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) {
@@ -103,7 +103,7 @@ public void addAspect(Object aspectInstance) {
* 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);
@@ -127,7 +127,7 @@ private void addAdvisorsFromAspectInstanceFactory(MetadataAwareAspectInstanceFac
/**
* 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");
@@ -141,7 +141,7 @@ private AspectMetadata createAspectMetadata(Class aspectClass, String aspectName
* 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) {
@@ -160,7 +160,7 @@ private MetadataAwareAspectInstanceFactory createAspectInstanceFactory(
* 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) {
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java
index cde9f43ef30c..2278185e174b 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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
@@ -55,8 +55,8 @@ public class AspectMetadata {
private final Pointcut perClausePointcut;
/**
- * The name of this aspect as defined to Spring (the bean name) -
- * allows us to determine if two pieces of advice come from the
+ * The name of this aspect as defined to Spring (the bean name) -
+ * allows us to determine if two pieces of advice come from the
* same aspect and hence their relative precedence.
*/
private String aspectName;
@@ -71,9 +71,9 @@ public AspectMetadata(Class> aspectClass, String aspectName) {
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 @@ private String findPerClause(Class> aspectClass) {
/**
* 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();
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java
index a640e364584a..0caceeeb4b9d 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
* backed by a Spring {@link org.springframework.beans.factory.BeanFactory}.
*
* Note that this may instantiate multiple times if using a prototype,
- * which probably won't give the semantics you expect.
+ * which probably won't give the semantics you expect.
* Use a {@link LazySingletonAspectInstanceFactoryDecorator}
* to wrap this to ensure only one new aspect comes back.
*
@@ -56,7 +56,7 @@ public class BeanFactoryAspectInstanceFactory implements MetadataAwareAspectInst
public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name) {
this(beanFactory, name, beanFactory.getType(name));
}
-
+
/**
* Create a BeanFactoryAspectInstanceFactory, providing a type that AspectJ should
* introspect to create AJType metadata. Use if the BeanFactory may consider the type
@@ -65,7 +65,7 @@ public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name) {
* @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);
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java
index c3c6de336517..fe126b0df38e 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,7 +96,7 @@ public List buildAspectJAdvisors() {
// 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 List buildAspectJAdvisors() {
}
if (aspectNames.isEmpty()) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List advisors = new LinkedList();
for (String aspectName : aspectNames) {
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java
index 433a33bb6b08..8c59e5ffb137 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,30 +41,30 @@ class InstantiationModelAwarePointcutAdvisorImpl
implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation {
private final AspectJExpressionPointcut declaredPointcut;
-
+
private Pointcut pointcut;
-
+
private final MetadataAwareAspectInstanceFactory aspectInstanceFactory;
-
+
private final Method method;
-
+
private final boolean lazy;
-
+
private final AspectJAdvisorFactory atAspectJAdvisorFactory;
-
+
private Advice instantiatedAdvice;
private int declarationOrder;
-
+
private String aspectName;
-
+
private Boolean isBeforeAdvice;
private Boolean isAfterAdvice;
- public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, AspectJExpressionPointcut ajexp,
- MetadataAwareAspectInstanceFactory aif, Method method, int declarationOrderInAspect, String aspectName) {
+ public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, AspectJExpressionPointcut ajexp,
+ MetadataAwareAspectInstanceFactory aif, Method method, int declarationOrderInAspect, String aspectName) {
this.declaredPointcut = ajexp;
this.method = method;
@@ -72,12 +72,12 @@ public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, Asp
this.aspectInstanceFactory = aif;
this.declarationOrder = declarationOrderInAspect;
this.aspectName = aspectName;
-
+
if (aif.getAspectMetadata().isLazilyInstantiated()) {
// Static part of the pointcut is a lazy type.
Pointcut preInstantiationPointcut =
Pointcuts.union(aif.getAspectMetadata().getPerClausePointcut(), this.declaredPointcut);
-
+
// Make it dynamic: must mutate from pre-instantiation to post-instantiation state.
// If it's not a dynamic pointcut, it may be optimized out
// by the Spring AOP infrastructure after the first evaluation.
@@ -109,7 +109,7 @@ public Pointcut getPointcut() {
public boolean isPerInstance() {
return (getAspectMetadata().getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON);
}
-
+
/**
* Return the AspectJ AspectMetadata for this advisor.
*/
@@ -126,7 +126,7 @@ public synchronized Advice getAdvice() {
}
return this.instantiatedAdvice;
}
-
+
public boolean isLazy() {
return this.lazy;
}
@@ -140,7 +140,7 @@ private Advice instantiateAdvice(AspectJExpressionPointcut pcut) {
return this.atAspectJAdvisorFactory.getAdvice(
this.method, pcut, this.aspectInstanceFactory, this.declarationOrder, this.aspectName);
}
-
+
public MetadataAwareAspectInstanceFactory getAspectInstanceFactory() {
return this.aspectInstanceFactory;
}
@@ -239,13 +239,13 @@ private PerTargetInstantiationModelPointcut(AspectJExpressionPointcut declaredPo
}
@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);
}
- 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));
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java
index c2e356678a7a..35ade227ce5c 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java
@@ -203,7 +203,7 @@ public Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut
return null;
}
- // If we get here, we know we have an AspectJ method.
+ // If we get here, we know we have an AspectJ method.
// Check that it's an AspectJ-annotated class
if (!isAspect(candidateAspectClass)) {
throw new AopConfigException("Advice must be declared inside an aspect type: " +
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java
index 33d19a8811be..10a6669dcc68 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ 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);
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java
index b0f747284bf8..36b3f59f3d0e 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java
@@ -2,7 +2,7 @@
/**
*
* Classes enabling AspectJ 5 @Annotated classes to be used in Spring AOP.
- *
+ *
* Normally to be used through an AspectJAutoProxyCreator rather than directly.
*
*/
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java
index 0cb786cc255d..b731d3e90e75 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
*/
public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator {
- private static final Comparator DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator();
+ private static final Comparator DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator();
/**
@@ -72,22 +72,21 @@ protected List sortAdvisors(List advisors) {
for (Advisor element : advisors) {
partiallyComparableAdvisors.add(
new PartiallyComparableAdvisorHolder(element, DEFAULT_PRECEDENCE_COMPARATOR));
- }
-
+ }
+
// sort it
- List sorted =
- (List) PartialOrder.sort(partiallyComparableAdvisors);
+ List sorted = PartialOrder.sort(partiallyComparableAdvisors);
if (sorted == null) {
// TODO: work harder to give a better error message here.
throw new IllegalArgumentException("Advice precedence circularity error");
}
-
+
// extract results again
List result = new LinkedList();
for (PartiallyComparableAdvisorHolder pcAdvisor : sorted) {
result.add(pcAdvisor.getAdvisor());
}
-
+
return result;
}
@@ -102,7 +101,7 @@ protected void extendAdvisors(List candidateAdvisors) {
}
@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 candidateAdvisors = findCandidateAdvisors();
for (Advisor advisor : candidateAdvisors) {
@@ -123,9 +122,9 @@ private static class PartiallyComparableAdvisorHolder implements PartialComparab
private final Advisor advisor;
- private final Comparator comparator;
+ private final Comparator comparator;
- public PartiallyComparableAdvisorHolder(Advisor advisor, Comparator comparator) {
+ public PartiallyComparableAdvisorHolder(Advisor advisor, Comparator comparator) {
this.advisor = advisor;
this.comparator = comparator;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java
index c293f0be721a..2445accb43c6 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@
* @author Juergen Hoeller
* @since 2.0
*/
-class AspectJPrecedenceComparator implements Comparator {
+class AspectJPrecedenceComparator implements Comparator {
private static final int HIGHER_PRECEDENCE = -1;
private static final int SAME_PRECEDENCE = 0;
@@ -106,14 +106,14 @@ private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2) {
boolean oneOrOtherIsAfterAdvice =
(AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2));
int adviceDeclarationOrderDelta = getAspectDeclarationOrder(advisor1) - getAspectDeclarationOrder(advisor2);
-
+
if (oneOrOtherIsAfterAdvice) {
// the advice declared last has higher precedence
if (adviceDeclarationOrderDelta < 0) {
// advice1 was declared before advice2
// so advice1 has lower precedence
return LOWER_PRECEDENCE;
- }
+ }
else if (adviceDeclarationOrderDelta == 0) {
return SAME_PRECEDENCE;
}
@@ -153,7 +153,7 @@ private String getAspectName(Advisor anAdvisor) {
}
private int getAspectDeclarationOrder(Advisor anAdvisor) {
- AspectJPrecedenceInformation precedenceInfo =
+ AspectJPrecedenceInformation precedenceInfo =
AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
if (precedenceInfo != null) {
return precedenceInfo.getDeclarationOrder();
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java
index 8355bc30826e..6dc2fdb0c0bb 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java
@@ -5,7 +5,7 @@
* annotation-style methods, and an AspectJExpressionPointcut: a Spring AOP Pointcut
* implementation that allows use of the AspectJ pointcut expression language with the Spring AOP
* runtime framework.
- *
+ *
* Note that use of this package does not require the use of the ajc compiler
* or AspectJ load-time weaver. It is intended to enable the use of a valuable subset of AspectJ
* functionality, with consistent semantics, with the proxy-based Spring AOP framework.
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java b/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java
index 43de1f644660..f041fef0b26d 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement
public final BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definitionHolder, ParserContext parserContext) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
-
+
// get the root bean name - will be the name of the generated proxy factory bean
String existingBeanName = definitionHolder.getBeanName();
BeanDefinition targetDefinition = definitionHolder.getBeanDefinition();
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java b/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java
index 4fa6a8a5524e..180ea636a365 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java
@@ -20,7 +20,7 @@
/**
* {@link ParseState} entry representing an advice element.
- *
+ *
* @author Mark Fisher
* @since 2.0
*/
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java b/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java
index fa635ae7a953..dc3b4f9ea8ee 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java
@@ -20,7 +20,7 @@
/**
* {@link ParseState} entry representing an advisor.
- *
+ *
* @author Mark Fisher
* @since 2.0
*/
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java b/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java
index dd568a51bd3b..297e2baf6b90 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,8 @@
/**
* Utility class for handling registration of AOP auto-proxy creators.
*
- *
Only a single auto-proxy creator can be registered yet multiple concrete
- * implementations are available. Therefore this class wraps a simple escalation
+ *
Only a single auto-proxy creator can be registered yet multiple concrete
+ * implementations are available. Therefore this class wraps a simple escalation
* protocol, allowing classes to request a particular auto-proxy creator and know
* that class, or a subclass thereof, will eventually be resident
* in the application context.
@@ -54,7 +54,7 @@ public abstract class AopConfigUtils {
/**
* Stores the auto proxy creator classes in escalation order.
*/
- private static final List APC_PRIORITY_LIST = new ArrayList();
+ private static final List> APC_PRIORITY_LIST = new ArrayList>();
/**
* Setup the escalation list.
@@ -105,7 +105,7 @@ static void forceAutoProxyCreatorToExposeProxy(BeanDefinitionRegistry registry)
}
- 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 @@ private static BeanDefinition registerOrEscalateApcAsRequired(Class cls, BeanDef
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;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java b/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java
index ae9888dca4de..e99ff42ea80f 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java b/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java
index 0aca37520bae..6c9359a9c441 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java b/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java
index de8beff487c1..9845c601a061 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -93,7 +93,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
private static final int ASPECT_INSTANCE_FACTORY_INDEX = 2;
private ParseState parseState = new ParseState();
-
+
public BeanDefinition parse(Element element, ParserContext parserContext) {
CompositeComponentDefinition compositeDef =
@@ -281,10 +281,10 @@ private AbstractBeanDefinition parseDeclareParents(Element declareParentsElement
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(DeclareParentsAdvisor.class);
builder.addConstructorArgValue(declareParentsElement.getAttribute(IMPLEMENT_INTERFACE));
builder.addConstructorArgValue(declareParentsElement.getAttribute(TYPE_PATTERN));
-
+
String defaultImpl = declareParentsElement.getAttribute(DEFAULT_IMPL);
String delegateRef = declareParentsElement.getAttribute(DELEGATE_REF);
-
+
if (StringUtils.hasText(defaultImpl) && !StringUtils.hasText(delegateRef)) {
builder.addConstructorArgValue(defaultImpl);
}
@@ -404,7 +404,7 @@ else if (pointcut instanceof String) {
/**
* 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;
@@ -435,7 +435,7 @@ private AbstractBeanDefinition parsePointcut(Element pointcutElement, ParserCont
String expression = pointcutElement.getAttribute(EXPRESSION);
AbstractBeanDefinition pointcutDefinition = null;
-
+
try {
this.parseState.push(new PointcutEntry(id));
pointcutDefinition = createPointcutDefinition(expression);
@@ -462,7 +462,7 @@ private AbstractBeanDefinition parsePointcut(Element pointcutElement, ParserCont
/**
* Parses the pointcut or pointcut-ref attributes of the supplied
* {@link Element} and add a pointcut property as appropriate. Generates a
- * {@link org.springframework.beans.factory.config.BeanDefinition} for the pointcut if necessary
+ * {@link org.springframework.beans.factory.config.BeanDefinition} for the pointcut if necessary
* and returns its bean name, otherwise returns the bean name of the referred pointcut.
*/
private Object parsePointcutProperty(Element element, ParserContext parserContext) {
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java b/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java
index 5891bc8455fd..a34a78dddf13 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@ public void setBeanFactory(BeanFactory beanFactory) {
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 + "'");
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java b/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java
index c308d5b83316..e1cf5f65f329 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java
@@ -20,7 +20,7 @@
/**
* {@link ParseState} entry representing a pointcut.
- *
+ *
* @author Mark Fisher
* @since 2.0
*/
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java b/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java
index ac118d7096cc..daf10524ba72 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition,
proxyTargetClass = Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS));
}
}
-
+
// Register the original bean definition as it will be referenced by the scoped proxy
// and is relevant for tooling (validation, navigation).
BeanDefinitionHolder holder =
diff --git a/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java b/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java
index 36c2a9c91182..21bf0edd5be3 100644
--- a/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java
+++ b/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java b/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java
index 397c97b7698b..dd7419a6bcc0 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,13 +52,13 @@ public interface Advised extends TargetClassAware {
* Return the interfaces proxied by the AOP proxy. Will not
* include the target class, which may also be proxied.
*/
- Class[] getProxiedInterfaces();
+ Class>[] getProxiedInterfaces();
/**
* Determine whether the given interface is proxied.
* @param intf the interface to check
*/
- boolean isInterfaceProxied(Class intf);
+ boolean isInterfaceProxied(Class> intf);
/**
@@ -124,7 +124,7 @@ public interface Advised extends TargetClassAware {
*/
void addAdvisor(Advisor advisor) throws AopConfigException;
- /**
+ /**
* Add an Advisor at the specified position in the chain.
* @param advisor the advisor to add at the specified position in the chain
* @param pos position in chain (0 is head). Must be valid.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java
index ebb59896ec6a..9c9871d8a789 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,7 +58,6 @@
* @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 interfaces = new ArrayList();
+ private List> interfaces = new ArrayList>();
/**
* List of Advisors. If an Advice is added, it will be wrapped
@@ -114,7 +113,7 @@ public AdvisedSupport() {
* Create a AdvisedSupport instance with the given parameters.
* @param interfaces the proxied interfaces
*/
- public AdvisedSupport(Class[] interfaces) {
+ public AdvisedSupport(Class>[] interfaces) {
this();
setInterfaces(interfaces);
}
@@ -158,7 +157,7 @@ public TargetSource getTargetSource() {
* @see #setTargetSource
* @see #setTarget
*/
- public void setTargetClass(Class targetClass) {
+ public void setTargetClass(Class> targetClass) {
this.targetSource = EmptyTargetSource.forClass(targetClass);
}
@@ -194,10 +193,10 @@ public AdvisorChainFactory getAdvisorChainFactory() {
/**
* Set the interfaces to be proxied.
*/
- public void setInterfaces(Class[] interfaces) {
+ 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);
}
}
@@ -206,7 +205,7 @@ public void setInterfaces(Class[] interfaces) {
* Add a new proxied interface.
* @param intf the additional interface to proxy
*/
- public void addInterface(Class intf) {
+ public void addInterface(Class> intf) {
Assert.notNull(intf, "Interface must not be null");
if (!intf.isInterface()) {
throw new IllegalArgumentException("[" + intf.getName() + "] is not an interface");
@@ -224,16 +223,16 @@ public void addInterface(Class intf) {
* @return true if the interface was removed; false
* if the interface was not found and hence could not be removed
*/
- public boolean removeInterface(Class intf) {
+ public boolean removeInterface(Class> intf) {
return this.interfaces.remove(intf);
}
- public Class[] getProxiedInterfaces() {
+ public Class>[] getProxiedInterfaces() {
return this.interfaces.toArray(new Class[this.interfaces.size()]);
}
- public boolean isInterfaceProxied(Class intf) {
- for (Class proxyIntf : this.interfaces) {
+ public boolean isInterfaceProxied(Class> intf) {
+ for (Class> proxyIntf : this.interfaces) {
if (intf.isAssignableFrom(proxyIntf)) {
return true;
}
@@ -351,8 +350,8 @@ public void addAdvisors(Collection advisors) {
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);
}
}
@@ -455,7 +454,7 @@ public boolean adviceIncluded(Advice advice) {
* @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) {
@@ -475,7 +474,7 @@ public int countAdvicesOfType(Class adviceClass) {
* @param targetClass the target class
* @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
*/
- public List getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass) {
+ public List getInterceptorsAndDynamicInterceptionAdvice(Method method, Class> targetClass) {
MethodCacheKey cacheKey = new MethodCacheKey(method);
List cached = this.methodCache.get(cacheKey);
if (cached == null) {
@@ -513,7 +512,7 @@ protected void copyConfigurationFrom(AdvisedSupport other, TargetSource targetSo
copyFrom(other);
this.targetSource = targetSource;
this.advisorChainFactory = other.advisorChainFactory;
- this.interfaces = new ArrayList(other.interfaces);
+ this.interfaces = new ArrayList>(other.interfaces);
for (Advisor advisor : advisors) {
if (advisor instanceof IntroductionAdvisor) {
validateIntroductionAdvisor((IntroductionAdvisor) advisor);
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java
index 53bb3b19c555..5ce1d132b912 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,6 @@ public interface AdvisorChainFactory {
* @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
*/
List getInterceptorsAndDynamicInterceptionAdvice(
- Advised config, Method method, Class targetClass);
+ Advised config, Method method, Class> targetClass);
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java
index d97934f16c2c..595eb35c65d5 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java
@@ -35,7 +35,7 @@
*
* Proxies may or may not allow advice changes to be made.
* If they do not permit advice changes (for example, because
- * the configuration was frozen) a proxy should throw an
+ * the configuration was frozen) a proxy should throw an
* {@link AopConfigException} on an attempted advice change.
*
* @author Rod Johnson
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java
index 28e48adb4f92..c542056483a2 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,11 +78,11 @@ public static Class> ultimateTargetClass(Object candidate) {
* @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};
}
@@ -96,7 +96,7 @@ public static Class[] completeProxiedInterfaces(AdvisedSupport advised) {
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 static Class[] completeProxiedInterfaces(AdvisedSupport advised) {
* in the original order (never 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 static Class[] proxiedUserInterfaces(Object proxy) {
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;
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
index bbf7015e0a6d..cf41efb47c33 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
@@ -778,7 +778,7 @@ public int accept(Method method) {
}
Class> targetClass = this.advised.getTargetClass();
// Proxy is not yet available, but that shouldn't matter.
- List> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);
+ List chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);
boolean haveAdvice = !chain.isEmpty();
boolean exposeProxy = this.advised.isExposeProxy();
boolean isStatic = this.advised.getTargetSource().isStatic();
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java
index 806e3602bc9e..188887aedf88 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@
public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializable {
public List 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.
@@ -92,7 +92,7 @@ else if (advisor instanceof IntroductionAdvisor) {
/**
* 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) {
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java
index 43293527e6d8..aa03891da4da 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java
@@ -50,7 +50,7 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
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.");
@@ -71,7 +71,7 @@ public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException
* (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])));
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java
index 0a0e1233871d..f043206b1e47 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java b/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java
index 24c0610c08be..c374535909fa 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java
@@ -114,7 +114,7 @@ public Object getProxy(ClassLoader classLoader) {
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);
}
@@ -124,8 +124,8 @@ public Object getProxy(ClassLoader classLoader) {
* 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)) {
@@ -153,7 +153,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
boolean setProxyContext = false;
TargetSource targetSource = this.advised.targetSource;
- Class targetClass = null;
+ Class> targetClass = null;
Object target = null;
try {
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java
index 989160bf65b2..fc721df0c366 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java
@@ -56,7 +56,7 @@ public ProxyFactory(Object target) {
* No target, only interfaces. Must add interceptors.
* @param proxyInterfaces the interfaces that the proxy should implement
*/
- public ProxyFactory(Class[] proxyInterfaces) {
+ public ProxyFactory(Class>[] proxyInterfaces) {
setInterfaces(proxyInterfaces);
}
@@ -68,7 +68,7 @@ public ProxyFactory(Class[] proxyInterfaces) {
* @param proxyInterface the interface that the proxy should implement
* @param interceptor the interceptor that the proxy should invoke
*/
- public ProxyFactory(Class proxyInterface, Interceptor interceptor) {
+ public ProxyFactory(Class> proxyInterface, Interceptor interceptor) {
addInterface(proxyInterface);
addAdvice(interceptor);
}
@@ -79,7 +79,7 @@ public ProxyFactory(Class proxyInterface, Interceptor interceptor) {
* @param proxyInterface the interface that the proxy should implement
* @param targetSource the TargetSource that the proxy should invoke
*/
- public ProxyFactory(Class proxyInterface, TargetSource targetSource) {
+ public ProxyFactory(Class> proxyInterface, TargetSource targetSource) {
addInterface(proxyInterface);
setTargetSource(targetSource);
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java
index 9b4461fcb4b6..920469b00eee 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,7 +100,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
protected final Log logger = LogFactory.getLog(getClass());
private String[] interceptorNames;
-
+
private String targetName;
private boolean autodetectInterfaces = true;
@@ -132,7 +132,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);
}
@@ -262,7 +262,7 @@ public Class> getObjectType() {
return this.singletonInstance.getClass();
}
}
- Class[] ifcs = getProxiedInterfaces();
+ Class>[] ifcs = getProxiedInterfaces();
if (ifcs.length == 1) {
return ifcs[0];
}
@@ -291,7 +291,7 @@ public boolean isSingleton() {
* @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);
}
@@ -305,7 +305,7 @@ private synchronized Object getSingletonInstance() {
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");
}
@@ -395,7 +395,7 @@ private void checkInterceptorNames() {
* @return 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));
}
@@ -543,10 +543,10 @@ private void addAdvisorOnChainCreation(Object next, String name) {
Advisor advisor = namedBeanToAdvisor(next);
if (logger.isTraceEnabled()) {
logger.trace("Adding advisor with name '" + name + "'");
- }
+ }
addAdvisor(advisor);
}
-
+
/**
* Return a TargetSource to use when creating a proxy. If the target was not
* specified at the end of the interceptorNames list, the TargetSource will be
@@ -627,24 +627,24 @@ private static class PrototypePlaceholderAdvisor implements Advisor, Serializabl
private final String beanName;
private final String message;
-
+
public PrototypePlaceholderAdvisor(String beanName) {
this.beanName = beanName;
this.message = "Placeholder for prototype Advisor/Advice with bean name '" + beanName + "'";
}
-
+
public String getBeanName() {
return beanName;
}
-
+
public Advice getAdvice() {
throw new UnsupportedOperationException("Cannot invoke methods: " + this.message);
}
-
+
public boolean isPerInstance() {
throw new UnsupportedOperationException("Cannot invoke methods: " + this.message);
}
-
+
@Override
public String toString() {
return this.message;
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java b/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java
index 458cc4651808..ef1b3d4e6b89 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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 interceptorsAndDynamicMethodMatchers) {
+ Class> targetClass, List interceptorsAndDynamicMethodMatchers) {
this.proxy = proxy;
this.target = target;
@@ -151,7 +151,7 @@ public Object proceed() throws Throwable {
}
Object interceptorOrInterceptionAdvice =
- this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex);
+ this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex);
if (interceptorOrInterceptionAdvice instanceof InterceptorAndDynamicMethodMatcher) {
// Evaluate dynamic method matcher here: static part will already have
// been evaluated and found to match.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java
index 5acc518359dc..50315c838fc3 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java
index f0b38d0d67cf..b4eb2d0ebfc9 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java
index 10f861330003..b0d02507f2d2 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java
index 1e0b0b6417ee..374d723e5b63 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java
index 8ac6e5c3e865..d3d8d245633e 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java
index 0cd2d7ef9dbf..58a81d442516 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ public abstract class GlobalAdvisorAdapterRegistry {
/**
* Keep track of a single instance so we can return it to classes that request it.
*/
- private static AdvisorAdapterRegistry instance = new DefaultAdvisorAdapterRegistry();
+ private static final AdvisorAdapterRegistry instance = new DefaultAdvisorAdapterRegistry();
/**
* Return the singleton {@link DefaultAdvisorAdapterRegistry} instance.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java
index 6757ab65f5b0..2a15da44c7bf 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java
index 82f339b3f643..2decf4590c7a 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java
index 0803088e8bbd..d7e7624c3d48 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java
index 8773e933c012..ab73574e7ea4 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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 exceptionHandlerMap = new HashMap();
+ private final Map, Method> exceptionHandlerMap = new HashMap, Method>();
/**
@@ -87,13 +87,13 @@ public ThrowsAdviceInterceptor(Object throwsAdvice) {
}
}
}
-
+
if (this.exceptionHandlerMap.isEmpty()) {
throw new IllegalArgumentException(
"At least one handler method must be found in class [" + throwsAdvice.getClass() + "]");
}
}
-
+
public int getHandlerMethodCount() {
return this.exceptionHandlerMap.size();
}
@@ -104,7 +104,7 @@ public int getHandlerMethodCount() {
* @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() + "]");
}
@@ -131,7 +131,7 @@ public Object invoke(MethodInvocation mi) throws Throwable {
throw ex;
}
}
-
+
private void invokeHandlerMethod(MethodInvocation mi, Throwable ex, Method method) throws Throwable {
Object[] handlerArgs;
if (method.getParameterTypes().length == 1) {
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java
index 5d216e9b6bf4..a479fbc86848 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java
index 765d127397ed..0b3d0a28bfc2 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java
@@ -7,7 +7,7 @@
* its capabilities, don't need to concern themselves with this package.
*
* You may wish to use these adapters to wrap Spring-specific advices, such as MethodBeforeAdvice,
- * in MethodInterceptor, to allow their use in another AOP framework supporting the AOP Alliance interfaces.
+ * in MethodInterceptor, to allow their use in another AOP framework supporting the AOP Alliance interfaces.
*
*
* These adapters do not depend on any other Spring framework classes to allow such usage.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java
index 8bca7ccd9d91..39e303bb08c2 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,8 +64,8 @@ protected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) {
@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 advisors = findEligibleAdvisors(beanClass, beanName);
if (advisors.isEmpty()) {
return DO_NOT_PROXY;
}
@@ -82,7 +82,7 @@ protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName
* @see #sortAdvisors
* @see #extendAdvisors
*/
- protected List findEligibleAdvisors(Class beanClass, String beanName) {
+ protected List findEligibleAdvisors(Class> beanClass, String beanName) {
List candidateAdvisors = findCandidateAdvisors();
List eligibleAdvisors = findAdvisorsThatCanApply(candidateAdvisors, beanClass, beanName);
extendAdvisors(eligibleAdvisors);
@@ -110,7 +110,7 @@ protected List findCandidateAdvisors() {
* @see ProxyCreationContext#getCurrentProxiedBeanName()
*/
protected List findAdvisorsThatCanApply(
- List candidateAdvisors, Class beanClass, String beanName) {
+ List candidateAdvisors, Class> beanClass, String beanName) {
ProxyCreationContext.setCurrentProxiedBeanName(beanName);
try {
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java
index 3216c3e101ff..f8c6da96b5c5 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java
@@ -151,11 +151,11 @@ public abstract class AbstractAutoProxyCreator extends ProxyConfig
* @param order ordering value
*/
public final void setOrder(int order) {
- this.order = order;
+ this.order = order;
}
public final int getOrder() {
- return this.order;
+ return this.order;
}
/**
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java
index 400018136950..ff749598c40f 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java
index a7b01b573c71..7f99f3d02332 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ public void setBeanNames(String[] beanNames) {
* 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)) {
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java
index 334b9a5cfed3..a7a67a24be19 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -94,6 +94,6 @@ public void setBeanName(String name) {
@Override
protected boolean isEligibleAdvisorBean(String beanName) {
return (!isUsePrefix() || beanName.startsWith(getAdvisorBeanNamePrefix()));
- }
+ }
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java
index 6219a5015c39..735a65b852e9 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@
* @author Juergen Hoeller
*/
public interface TargetSourceCreator {
-
+
/**
* Create a special TargetSource for the given bean, if any.
* @param beanClass the class of the bean to create a TargetSource for
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java
index 691464cd7da9..8646ea495885 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java
@@ -3,10 +3,10 @@
*
* Bean post-processors for use in ApplicationContexts to simplify AOP usage
* by automatically creating AOP proxies without the need to use a ProxyFactoryBean.
- *
+ *
* The various post-processors in this package need only be added to an ApplicationContext
* (typically in an XML bean definition document) to automatically proxy selected beans.
- *
+ *
*
NB : Automatic auto-proxying is not supported for BeanFactory implementations,
* as post-processors beans are only automatically detected in application contexts.
* Post-processors can be explicitly registered on a ConfigurableBeanFactory instead.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java
index a7bf4b490cc1..3e3870f22d4a 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java
index a32f3a3f2c55..25210f45e67b 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ protected boolean isPrototypeBased() {
@Override
protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
- Class beanClass, String beanName) {
+ Class> beanClass, String beanName) {
if (getBeanFactory() instanceof ConfigurableListableBeanFactory) {
BeanDefinition definition =
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java
index 094188be1c9c..dc37b8099f0f 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
/**
* Convenient TargetSourceCreator using bean name prefixes to create one of three
- * well-known TargetSource types:
+ * well-known TargetSource types:
*
: CommonsPoolTargetSource
* % ThreadLocalTargetSource
* ! PrototypeTargetSource
@@ -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();
@@ -59,5 +59,5 @@ else if (beanName.startsWith(PREFIX_PROTOTYPE)) {
return null;
}
}
-
+
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java b/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java
index 4958a010cbaa..3581a82efe38 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java
@@ -3,13 +3,13 @@
*
* Package containing Spring's basic AOP infrastructure, compliant with the
* AOP Alliance interfaces.
- *
+ *
* Spring AOP supports proxying interfaces or classes, introductions, and offers
* static and dynamic pointcuts.
- *
+ *
*
Any Spring AOP proxy can be cast to the ProxyConfig AOP configuration interface
* in this package to add or remove interceptors.
- *
+ *
*
The ProxyFactoryBean is a convenient way to create AOP proxies in a BeanFactory
* or ApplicationContext. However, proxies can be created programmatically using the
* ProxyFactory class.
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java
index 0c257c1c506f..8502faa7b7e1 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
*
Subclasses should call the createInvocationTraceName(MethodInvocation)
* method to create a name for the given trace that includes information about the
* method invocation under trace along with the prefix and suffix added as appropriate.
- *
+ *
* @author Rob Harrop
* @author Juergen Hoeller
* @since 1.2.7
@@ -97,7 +97,7 @@ public void setLogTargetClassInvocation(boolean logTargetClassInvocation) {
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();
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java
index 2c367c20c044..f13fdcaf3095 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -140,7 +140,7 @@ protected Log getLoggerForInvocation(MethodInvocation invocation) {
* @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());
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java
index bf14ab64308b..881fef9e34a4 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2005 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java
index db00bcbbf6f8..8eb71609b6f1 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -150,7 +150,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
/**
* The Set of allowed placeholders.
*/
- private static final Set ALLOWED_PLACEHOLDERS =
+ private static final Set ALLOWED_PLACEHOLDERS =
new Constants(CustomizableTraceInterceptor.class).getValues("PLACEHOLDER_");
@@ -393,7 +393,7 @@ else if (returnValue == null) {
* @param output the 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]);
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java
index 81b31107424d..bf55f76a5a7a 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -125,7 +125,7 @@ public Object invoke(MethodInvocation mi) throws Throwable {
*/
private static class ExposeBeanNameIntroduction extends DelegatingIntroductionInterceptor implements NamedBean {
- private final String beanName;
+ private final String beanName;
public ExposeBeanNameIntroduction(String beanName) {
this.beanName = beanName;
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java
index 86ac2027569c..d61caa219467 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java
index 0ea4dd527f40..801567245bdd 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
* and output the stats.
*
* This code is inspired by Thierry Templier's blog.
- *
+ *
* @author Dmitriy Kopylenko
* @author Juergen Hoeller
* @author Rob Harrop
diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java
index f22f54a77bcd..e4e3bc0f60b1 100644
--- a/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/package-info.java b/spring-aop/src/main/java/org/springframework/aop/package-info.java
index 5076bc067815..b5691ccfa67d 100644
--- a/spring-aop/src/main/java/org/springframework/aop/package-info.java
+++ b/spring-aop/src/main/java/org/springframework/aop/package-info.java
@@ -2,9 +2,9 @@
/**
*
* Core Spring AOP interfaces, built on AOP Alliance AOP interoperability interfaces.
- *
+ *
* Any AOP Alliance MethodInterceptor is usable in Spring.
- *
+ *
* Spring AOP also offers:
*
* Introduction support
@@ -15,7 +15,7 @@
* Extensibility allowing arbitrary custom advice types to
* be plugged in without modifying the core framework.
*
- *
+ *
*
* Spring AOP can be used programmatically or (preferably)
* integrated with the Spring IoC container.
diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java b/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java
index 77c3a107ab06..05a041aeec74 100644
--- a/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java
+++ b/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java
@@ -23,7 +23,7 @@
/**
* Default implementation of the {@link ScopedObject} interface.
- *
+ *
* Simply delegates the calls to the underlying
* {@link ConfigurableBeanFactory bean factory}
* ({@link ConfigurableBeanFactory#getBean(String)}/
diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java
index 1a5008264168..9e46d230cd2c 100644
--- a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java
+++ b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java
@@ -49,5 +49,5 @@ public interface ScopedObject extends RawTargetAccess {
* the exact same target object in the target scope).
*/
void removeFromScope();
-
+
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java
index b13a9eb50995..826e4a06adde 100644
--- a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java
+++ b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,14 +32,14 @@
/**
* Convenient proxy factory bean for scoped objects.
- *
+ *
*
Proxies created using this factory bean are thread-safe singletons
* and may be injected into shared objects, with transparent scoping behavior.
*
*
Proxies returned by this class implement the {@link ScopedObject} interface.
* This presently allows for removing the corresponding object from the scope,
* seamlessly creating a new instance in the scope on next access.
- *
+ *
*
Please note that the proxies created by this factory are
* class-based proxies by default. This can be customized
* through switching the "proxyTargetClass" property to "false".
@@ -89,7 +89,7 @@ public void setBeanFactory(BeanFactory beanFactory) {
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.");
diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java
index 62f13bb5c8ac..e59267d30f38 100644
--- a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java
+++ b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java
@@ -47,7 +47,7 @@ public abstract class ScopedProxyUtils {
*/
public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder definition,
BeanDefinitionRegistry registry, boolean proxyTargetClass) {
-
+
String originalBeanName = definition.getBeanName();
BeanDefinition targetDefinition = definition.getBeanDefinition();
@@ -87,7 +87,7 @@ public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder defini
// (potentially an inner bean).
return new BeanDefinitionHolder(proxyDefinition, originalBeanName, definition.getAliases());
}
-
+
/**
* Generates the bean name that is used within the scoped proxy to reference the target bean.
* @param originalBeanName the original name of bean
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
index 0d11ab36a748..5d16f3d24afd 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java
index a9031bcc3c07..f97836bc5cad 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java
index ac64a992267b..e9bafe25d1dd 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java
@@ -123,7 +123,7 @@ public String[] getExcludedPatterns() {
* of the target class as well as against the method's declaring class,
* plus the name of the method.
*/
- 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()));
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java
index 86234323a256..aca8a6f9ac32 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java
@@ -215,7 +215,7 @@ public static boolean canApply(Pointcut pc, Class> targetClass, boolean hasInt
introductionAwareMethodMatcher = (IntroductionAwareMethodMatcher) methodMatcher;
}
- Set classes = new HashSet(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
+ Set> classes = new HashSet>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
classes.add(targetClass);
for (Class> clazz : classes) {
Method[] methods = clazz.getMethods();
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java b/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java
index e8fd0213ea3f..cd03b81739c0 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,7 +95,7 @@ public UnionClassFilter(ClassFilter[] filters) {
this.filters = filters;
}
- 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;
@@ -128,7 +128,7 @@ public IntersectionClassFilter(ClassFilter[] filters) {
this.filters = filters;
}
- 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;
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java
index e0d0b6dc33d1..3adf703d7ce5 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@
*/
public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher, Serializable {
- private Class clazz;
+ private Class> clazz;
private String methodName;
@@ -49,7 +49,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);
}
@@ -60,7 +60,7 @@ public ControlFlowPointcut(Class clazz) {
* @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;
@@ -70,7 +70,7 @@ public ControlFlowPointcut(Class clazz, String methodName) {
/**
* Subclasses can override this for greater filtering (and performance).
*/
- public boolean matches(Class clazz) {
+ public boolean matches(Class> clazz) {
return true;
}
@@ -78,7 +78,7 @@ public boolean matches(Class clazz) {
* Subclasses can override this if it's possible to filter out
* some candidate classes.
*/
- public boolean matches(Method method, Class targetClass) {
+ public boolean matches(Method method, Class> targetClass) {
return true;
}
@@ -86,7 +86,7 @@ public boolean isRuntime() {
return true;
}
- 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);
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java
index 194ae88656e5..0267e932c957 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,12 +38,12 @@
* @author Juergen Hoeller
* @since 11.11.2003
*/
-@SuppressWarnings({ "unchecked", "serial" })
+@SuppressWarnings({ "serial" })
public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFilter, Ordered, Serializable {
private final Advice advice;
-
- private final Set interfaces = new HashSet();
+
+ private final Set> interfaces = new HashSet>();
private int order = Integer.MAX_VALUE;
@@ -68,11 +68,11 @@ public DefaultIntroductionAdvisor(Advice advice, IntroductionInfo introductionIn
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 DefaultIntroductionAdvisor(Advice advice, IntroductionInfo introductionIn
* @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 DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class intf)
* 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");
@@ -102,12 +102,12 @@ public void addInterface(Class intf) {
this.interfaces.add(intf);
}
- public Class[] getInterfaces() {
+ public Class>[] getInterfaces() {
return this.interfaces.toArray(new Class[this.interfaces.size()]);
}
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 + "] " +
@@ -138,7 +138,7 @@ public ClassFilter getClassFilter() {
return this;
}
- public boolean matches(Class clazz) {
+ public boolean matches(Class> clazz) {
return true;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java
index cb4402683d81..1817be6d6d16 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor imple
*/
public DefaultPointcutAdvisor() {
}
-
+
/**
* Create a DefaultPointcutAdvisor that matches all methods.
* Pointcut.TRUE will be used as Pointcut.
@@ -55,7 +55,7 @@ public DefaultPointcutAdvisor() {
public DefaultPointcutAdvisor(Advice advice) {
this(Pointcut.TRUE, advice);
}
-
+
/**
* Create a DefaultPointcutAdvisor, specifying Pointcut and Advice.
* @param pointcut the Pointcut targeting the Advice
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java
index 5278ee233fff..baa2becbeffa 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2087 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,17 +53,17 @@
public class DelegatePerTargetObjectIntroductionInterceptor extends IntroductionInfoSupport
implements IntroductionInterceptor {
- /**
+ /**
* Hold weak references to keys as we don't want to interfere with garbage collection..
*/
private final Map delegateMap = new WeakHashMap();
- 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).
@@ -85,12 +85,12 @@ public DelegatePerTargetObjectIntroductionInterceptor(Class defaultImplType, Cla
public Object invoke(MethodInvocation mi) throws Throwable {
if (isMethodOnIntroducedInterface(mi)) {
Object delegate = getIntroductionDelegateFor(mi.getThis());
-
+
// Using the following method rather than direct reflection,
// we get correct handling of InvocationTargetException
// if the introduced method throws an exception.
Object retVal = AopUtils.invokeJoinpointUsingReflection(delegate, mi.getMethod(), mi.getArguments());
-
+
// Massage return value if possible: if the delegate returned itself,
// we really want to return the proxy.
if (retVal == delegate && mi instanceof ProxyMethodInvocation) {
@@ -126,7 +126,7 @@ private Object getIntroductionDelegateFor(Object targetObject) {
}
}
}
-
+
private Object createNewDelegate() {
try {
return this.defaultImplType.newInstance();
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java
index fc9631bd6137..ea5b62e63d6b 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@
* The suppressInterface method can be used to suppress interfaces
* implemented by the delegate but which should not be introduced to the owning
* AOP proxy.
- *
+ *
*
An instance of this class is serializable if the delegate is.
*
* @author Rod Johnson
@@ -50,7 +50,7 @@
*/
public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport
implements IntroductionInterceptor {
-
+
/**
* Object that actually implements the interfaces.
* May be "this" if a subclass implements the introduced interfaces.
@@ -66,7 +66,7 @@ public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport
public DelegatingIntroductionInterceptor(Object delegate) {
init(delegate);
}
-
+
/**
* Construct a new DelegatingIntroductionInterceptor.
* The delegate will be the subclass, which must implement
@@ -91,10 +91,10 @@ private void init(Object delegate) {
suppressInterface(IntroductionInterceptor.class);
suppressInterface(DynamicIntroductionAdvice.class);
}
-
-
+
+
/**
- * Subclasses may need to override this if they want to perform custom
+ * Subclasses may need to override this if they want to perform custom
* behaviour in around advice. However, subclasses should invoke this
* method, which handles introduced interfaces and forwarding to the target.
*/
@@ -104,7 +104,7 @@ public Object invoke(MethodInvocation mi) throws Throwable {
// get correct handling of InvocationTargetException
// if the introduced method throws an exception.
Object retVal = AopUtils.invokeJoinpointUsingReflection(this.delegate, mi.getMethod(), mi.getArguments());
-
+
// Massage return value if possible: if the delegate returned itself,
// we really want to return the proxy.
if (retVal == this.delegate && mi instanceof ProxyMethodInvocation) {
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java
index d011aa641bad..6a6a70c98514 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java
index 5adc4fa53955..e70530b09829 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java b/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java
index c04c049163e7..82006e06bc5c 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@
*/
public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
- protected final Set publishedInterfaces = new HashSet();
+ protected final Set> publishedInterfaces = new HashSet>();
private transient Map rememberedMethods = new ConcurrentHashMap(32);
@@ -54,11 +54,11 @@ public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
* 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);
}
- public Class[] getInterfaces() {
+ public Class>[] getInterfaces() {
return this.publishedInterfaces.toArray(new Class[this.publishedInterfaces.size()]);
}
@@ -67,8 +67,8 @@ public Class[] getInterfaces() {
* @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;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java
index d2a4fe139516..61595ff86ac4 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java
@@ -38,13 +38,13 @@
* @since 1.1
*/
public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
-
- /**
+
+ /**
* Compiled form of the patterns.
*/
private Pattern[] compiledPatterns = new Pattern[0];
- /**
+ /**
* Compiled form of the exclusion patterns.
*/
private Pattern[] compiledExclusionPatterns = new Pattern[0];
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java b/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java
index b4d4fd6f4793..58b8fdde5748 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -88,7 +88,7 @@ public static MethodMatcher intersection(MethodMatcher mm1, MethodMatcher mm2) {
* asking is the subject on one or more introductions; 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)) ||
@@ -111,21 +111,21 @@ public UnionMethodMatcher(MethodMatcher mm1, MethodMatcher mm2) {
this.mm2 = mm2;
}
- 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));
}
- 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;
}
@@ -133,7 +133,7 @@ public boolean isRuntime() {
return this.mm1.isRuntime() || this.mm2.isRuntime();
}
- 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);
}
@@ -175,12 +175,12 @@ public ClassFilterAwareUnionMethodMatcher(MethodMatcher mm1, ClassFilter cf1, Me
}
@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);
}
@@ -213,12 +213,12 @@ public IntersectionMethodMatcher(MethodMatcher mm1, MethodMatcher mm2) {
this.mm2 = mm2;
}
- 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);
}
- 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);
}
@@ -226,7 +226,7 @@ public boolean isRuntime() {
return this.mm1.isRuntime() || this.mm2.isRuntime();
}
- 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.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java
index 44a03380ff4e..feafd4869b6b 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ public NameMatchMethodPointcut addMethodName(String name) {
}
- 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;
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java
index 4cd21ec070fa..e521736bf550 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java b/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java
index cdeb21e8b910..3dbe5310c264 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,7 +71,7 @@ public static Pointcut intersection(Pointcut pc1, Pointcut pc2) {
* @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;
@@ -95,7 +95,7 @@ private static class SetterPointcut extends StaticMethodMatcherPointcut implemen
public static SetterPointcut INSTANCE = new SetterPointcut();
- 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;
@@ -114,7 +114,7 @@ private static class GetterPointcut extends StaticMethodMatcherPointcut implemen
public static GetterPointcut INSTANCE = new GetterPointcut();
- public boolean matches(Method method, Class targetClass) {
+ public boolean matches(Method method, Class> targetClass) {
return method.getName().startsWith("get") &&
method.getParameterTypes().length == 0;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java
index a610e37f71e9..e96d1abe6a05 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java b/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java
index 193de1d96956..61fbc351b7c1 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2005 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,16 +25,16 @@
* @author Rod Johnson
*/
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;
}
- public boolean matches(Class candidate) {
+ public boolean matches(Class> candidate) {
return clazz.isAssignableFrom(candidate);
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java
index 8023ff883735..27209a18ac15 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@
/**
* Convenient abstract superclass for static method matchers, which don't care
- * about arguments at runtime.
+ * about arguments at runtime.
*/
public abstract class StaticMethodMatcher implements MethodMatcher {
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java
index 921129c89b06..5ff78837c566 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java
index 9136c8974e71..d312c4f37108 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ public AnnotationClassFilter(Class extends Annotation> annotationType, boolean
}
- public boolean matches(Class clazz) {
+ public boolean matches(Class> clazz) {
return (this.checkInherited ?
(AnnotationUtils.findAnnotation(clazz, this.annotationType) != null) :
clazz.isAnnotationPresent(this.annotationType));
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java
index 4f4dd6c391a3..4f7cfbb833fd 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java
@@ -47,7 +47,7 @@ public AnnotationMethodMatcher(Class extends Annotation> annotationType) {
}
- public boolean matches(Method method, Class targetClass) {
+ public boolean matches(Method method, Class> targetClass) {
if (method.isAnnotationPresent(this.annotationType)) {
return true;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java
index 2980b0bf4268..f3437fb29ce4 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -97,7 +97,7 @@ public String getTargetBeanName() {
*
Default is to detect the type automatically, through a getType
* call on the BeanFactory (or even a full getBean call as fallback).
*/
- public void setTargetClass(Class targetClass) {
+ public void setTargetClass(Class> targetClass) {
this.targetClass = targetClass;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java
index 3119e847f1b6..b78e18faf691 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java
index 8111f2e4c47d..3c73521e7499 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java
@@ -90,7 +90,7 @@ public final void setBeanFactory(BeanFactory beanFactory) throws BeansException
* @throws Exception to avoid placing constraints on pooling APIs
*/
protected abstract void createPool() throws Exception;
-
+
/**
* Acquire an object from the pool.
* @return an object from the pool
@@ -98,7 +98,7 @@ public final void setBeanFactory(BeanFactory beanFactory) throws BeansException
* APIs, so we're forgiving with our exception signature
*/
public abstract Object getTarget() throws Exception;
-
+
/**
* Return the given object to the pool.
* @param target object that must have been acquired from the pool
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java
index 887e253a087b..cc9641a3fc73 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@
* properties are explictly not mirrored because the implementation of
* PoolableObjectFactory used by this class does not implement
* meaningful validation. All exposed Commons Pool properties use the corresponding
- * Commons Pool defaults: for example,
+ * Commons Pool defaults: for example,
*
* @author Rod Johnson
* @author Rob Harrop
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java
index d67b03f0f3c2..e20bac8b59f2 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ public class EmptyTargetSource implements TargetSource, Serializable {
* @param targetClass the target Class (may be null)
* @see #getTargetClass()
*/
- public static EmptyTargetSource forClass(Class targetClass) {
+ public static EmptyTargetSource forClass(Class> targetClass) {
return forClass(targetClass, true);
}
@@ -60,7 +60,7 @@ public static EmptyTargetSource forClass(Class targetClass) {
* @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 static EmptyTargetSource forClass(Class targetClass, boolean isStatic) {
// Instance implementation
//---------------------------------------------------------------------
- private final Class targetClass;
+ private final Class> targetClass;
private final boolean isStatic;
@@ -81,7 +81,7 @@ public static EmptyTargetSource forClass(Class targetClass, boolean isStatic) {
* @param targetClass the target class to expose (may be 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;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java b/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java
index 4327a2747a2b..ddaad787043b 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java
index 08ae6534a64c..844073a5ab82 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java
@@ -58,11 +58,11 @@ public SingletonTargetSource(Object target) {
public Class> getTargetClass() {
return this.target.getClass();
}
-
+
public Object getTarget() {
return this.target;
}
-
+
public void releaseTarget(Object target) {
// nothing to do
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java
index 6048f7b48466..e614f27a8b8d 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java
@@ -49,7 +49,7 @@
*/
public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
implements ThreadLocalTargetSourceStats, DisposableBean {
-
+
/**
* ThreadLocal holding the target associated with the current
* thread. Unlike most ThreadLocals, which are static, this variable
@@ -61,10 +61,10 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
/**
* Set of managed targets, enabling us to keep track of the targets we've created.
*/
- private final Set targetSet = new HashSet();
-
+ private final Set targetSet = Collections.synchronizedSet(new HashSet());
+
private int invocationCount;
-
+
private int hitCount;
@@ -79,7 +79,7 @@ public Object getTarget() throws BeansException {
if (target == null) {
if (logger.isDebugEnabled()) {
logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " +
- "creating one and binding it to thread '" + Thread.currentThread().getName() + "'");
+ "creating one and binding it to thread '" + Thread.currentThread().getName() + "'");
}
// Associate target with ThreadLocal.
target = newPrototypeInstance();
@@ -93,7 +93,7 @@ public Object getTarget() throws BeansException {
}
return target;
}
-
+
/**
* Dispose of targets if necessary; clear ThreadLocal.
* @see #destroyPrototypeInstance
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java
index 7e3a2fa5cf50..688b89133066 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,7 @@
* @author Juergen Hoeller
*/
public interface ThreadLocalTargetSourceStats {
-
+
/**
* Return the number of client invocations.
*/
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java
index befbcf393928..e4c805010d03 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java
index 7d55a0d59a18..82d16e7fd489 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2006 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java
index 3bc43af65764..0d523ba87e3d 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java
@@ -36,7 +36,7 @@ public final class AspectJAdviceParameterNameDiscoverAnnotationTests
@Retention(RetentionPolicy.RUNTIME)
@interface MyAnnotation {}
-
+
public void pjpAndAnAnnotation(ProceedingJoinPoint pjp, MyAnnotation ann) {}
@Test
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
index f135239fe093..7662195c0fd0 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -247,7 +247,7 @@ public void testReferenceBinding() {
public void testReferenceBindingWithAlternateTokenizations() {
assertParameterNames(getMethod("onePrimitive"),"call(bar *) && somepc(foo)",new String[] {"foo"});
assertParameterNames(getMethod("onePrimitive"),"somepc ( foo )",new String[] {"foo"});
- assertParameterNames(getMethod("onePrimitive"),"somepc( foo)",new String[] {"foo"});
+ assertParameterNames(getMethod("onePrimitive"),"somepc( foo)",new String[] {"foo"});
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
index b1678c9d7c89..d34e0d794721 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,7 +44,7 @@
* @author Chris Beams
*/
public final class AspectJExpressionPointcutTests {
-
+
public static final String MATCH_ALL_METHODS = "execution(* *(..))";
private Method getAge;
@@ -53,17 +53,14 @@ public final class AspectJExpressionPointcutTests {
private Method setSomeNumber;
- private Method isPostProcessed;
-
-
@Before
public void setUp() throws NoSuchMethodException {
getAge = TestBean.class.getMethod("getAge", (Class>[])null);
setAge = TestBean.class.getMethod("setAge", new Class[]{int.class});
setSomeNumber = TestBean.class.getMethod("setSomeNumber", new Class[]{Number.class});
- isPostProcessed = TestBean.class.getMethod("isPostProcessed", (Class[]) null);
+ TestBean.class.getMethod("isPostProcessed", (Class[]) null);
}
-
+
@Test
public void testMatchExplicit() {
String expression = "execution(int test.beans.TestBean.getAge())";
@@ -100,60 +97,60 @@ public void testMatchWithTypePattern() throws Exception {
assertTrue("Expression should match setAge(int) method", methodMatcher.matches(setAge, TestBean.class));
}
-
+
@Test
public void testThis() throws SecurityException, NoSuchMethodException{
testThisOrTarget("this");
}
-
+
@Test
public void testTarget() throws SecurityException, NoSuchMethodException {
testThisOrTarget("target");
}
-
+
public static class OtherIOther implements IOther {
public void absquatulate() {
// Empty
}
-
+
}
-
+
/**
* This and target are equivalent. Really instanceof pointcuts.
- * @throws Exception
* @param which this or target
- * @throws NoSuchMethodException
- * @throws SecurityException
+ * @throws Exception
+ * @throws NoSuchMethodException
+ * @throws SecurityException
*/
private void testThisOrTarget(String which) throws SecurityException, NoSuchMethodException {
String matchesTestBean = which + "(test.beans.TestBean)";
String matchesIOther = which + "(test.beans.IOther)";
AspectJExpressionPointcut testBeanPc = new AspectJExpressionPointcut();
testBeanPc.setExpression(matchesTestBean);
-
+
AspectJExpressionPointcut iOtherPc = new AspectJExpressionPointcut();
iOtherPc.setExpression(matchesIOther);
-
+
assertTrue(testBeanPc.matches(TestBean.class));
assertTrue(testBeanPc.matches(getAge, TestBean.class));
assertTrue(iOtherPc.matches(OtherIOther.class.getMethod("absquatulate", (Class>[])null),
OtherIOther.class));
-
+
assertFalse(testBeanPc.matches(OtherIOther.class.getMethod("absquatulate", (Class>[])null),
OtherIOther.class));
}
-
+
@Test
public void testWithinRootPackage() throws SecurityException, NoSuchMethodException {
testWithinPackage(false);
}
-
+
@Test
public void testWithinRootAndSubpackages() throws SecurityException, NoSuchMethodException {
testWithinPackage(true);
}
-
+
private void testWithinPackage(boolean matchSubpackages) throws SecurityException, NoSuchMethodException {
String withinBeansPackage = "within(test.beans.";
// Subpackages are matched by **
@@ -163,7 +160,7 @@ private void testWithinPackage(boolean matchSubpackages) throws SecurityExceptio
withinBeansPackage = withinBeansPackage + "*)";
AspectJExpressionPointcut withinBeansPc = new AspectJExpressionPointcut();
withinBeansPc.setExpression(withinBeansPackage);
-
+
assertTrue(withinBeansPc.matches(TestBean.class));
assertTrue(withinBeansPc.matches(getAge, TestBean.class));
assertEquals(matchSubpackages, withinBeansPc.matches(DeepBean.class));
@@ -173,7 +170,7 @@ private void testWithinPackage(boolean matchSubpackages) throws SecurityExceptio
assertFalse(withinBeansPc.matches(OtherIOther.class.getMethod("absquatulate", (Class>[])null),
OtherIOther.class));
}
-
+
@Test
public void testFriendlyErrorOnNoLocationClassMatching() {
AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
@@ -185,7 +182,7 @@ public void testFriendlyErrorOnNoLocationClassMatching() {
assertTrue(ex.getMessage().indexOf("expression") != -1);
}
}
-
+
@Test
public void testFriendlyErrorOnNoLocation2ArgMatching() {
AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
@@ -197,7 +194,7 @@ public void testFriendlyErrorOnNoLocation2ArgMatching() {
assertTrue(ex.getMessage().indexOf("expression") != -1);
}
}
-
+
@Test
public void testFriendlyErrorOnNoLocation3ArgMatching() {
AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
@@ -210,7 +207,7 @@ public void testFriendlyErrorOnNoLocation3ArgMatching() {
}
}
-
+
@Test
public void testMatchWithArgs() throws Exception {
String expression = "execution(void test.beans.TestBean.setSomeNumber(Number)) && args(Double)";
@@ -308,10 +305,6 @@ private void assertMatchesTestBeanClass(ClassFilter classFilter) {
assertTrue("Expression should match TestBean class", classFilter.matches(TestBean.class));
}
- private void assertDoesNotMatchStringClass(ClassFilter classFilter) {
- assertFalse("Expression should not match String class", classFilter.matches(String.class));
- }
-
@Test
public void testWithUnsupportedPointcutPrimitive() throws Exception {
String expression = "call(int test.beans.TestBean.getAge())";
@@ -329,19 +322,19 @@ public void testWithUnsupportedPointcutPrimitive() throws Exception {
@Test
public void testAndSubstitution() {
Pointcut pc = getPointcut("execution(* *(..)) and args(String)");
- PointcutExpression expr =
+ PointcutExpression expr =
((AspectJExpressionPointcut) pc).getPointcutExpression();
assertEquals("execution(* *(..)) && args(String)",expr.getPointcutExpression());
}
-
+
@Test
public void testMultipleAndSubstitutions() {
Pointcut pc = getPointcut("execution(* *(..)) and args(String) and this(Object)");
- PointcutExpression expr =
+ PointcutExpression expr =
((AspectJExpressionPointcut) pc).getPointcutExpression();
- assertEquals("execution(* *(..)) && args(String) && this(Object)",expr.getPointcutExpression());
+ assertEquals("execution(* *(..)) && args(String) && this(Object)",expr.getPointcutExpression());
}
-
+
private Pointcut getPointcut(String expression) {
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
pointcut.setExpression(expression);
@@ -367,4 +360,4 @@ public void reset() {
this.count = 0;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
index ce148b7faa42..a38779c4b743 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,8 +34,8 @@ public final class BeanNamePointcutMatchingTests {
public void testMatchingPointcuts() {
assertMatch("someName", "bean(someName)");
- // Spring bean names are less restrictive compared to AspectJ names (methods, types etc.)
- // MVC Controller-kind
+ // Spring bean names are less restrictive compared to AspectJ names (methods, types etc.)
+ // MVC Controller-kind
assertMatch("someName/someOtherName", "bean(someName/someOtherName)");
assertMatch("someName/foo/someOtherName", "bean(someName/*/someOtherName)");
assertMatch("someName/foo/bar/someOtherName", "bean(someName/*/someOtherName)");
@@ -58,9 +58,9 @@ public void testMatchingPointcuts() {
// Or, and, not expressions
assertMatch("someName", "bean(someName) || bean(someOtherName)");
assertMatch("someOtherName", "bean(someName) || bean(someOtherName)");
-
+
assertMatch("someName", "!bean(someOtherName)");
-
+
assertMatch("someName", "bean(someName) || !bean(someOtherName)");
assertMatch("someName", "bean(someName) && !bean(someOtherName)");
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java
index 6de4f5c6407f..da541816583e 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,31 +72,31 @@ public void testCanGetMethodSignatureFromJoinPoint() {
final Object raw = new TestBean();
// Will be set by advice during a method call
final int newAge = 23;
-
+
ProxyFactory pf = new ProxyFactory(raw);
pf.setExposeProxy(true);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvice(new MethodBeforeAdvice() {
private int depth;
-
+
public void before(Method method, Object[] args, Object target) throws Throwable {
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
assertTrue("Method named in toString", jp.toString().contains(method.getName()));
// Ensure that these don't cause problems
jp.toShortString();
jp.toLongString();
-
+
assertSame(target, AbstractAspectJAdvice.currentJoinPoint().getTarget());
assertFalse(AopUtils.isAopProxy(AbstractAspectJAdvice.currentJoinPoint().getTarget()));
-
+
ITestBean thisProxy = (ITestBean) AbstractAspectJAdvice.currentJoinPoint().getThis();
assertTrue(AopUtils.isAopProxy(AbstractAspectJAdvice.currentJoinPoint().getThis()));
-
+
assertNotSame(target, thisProxy);
-
+
// Check getting again doesn't cause a problem
assertSame(thisProxy, AbstractAspectJAdvice.currentJoinPoint().getThis());
-
+
// Try reentrant call--will go through this advice.
// Be sure to increment depth to avoid infinite recursion
if (depth++ == 0) {
@@ -109,10 +109,10 @@ public void before(Method method, Object[] args, Object target) throws Throwable
assertSame(AopContext.currentProxy(), thisProxy);
assertSame(target, raw);
-
+
assertSame(method.getName(), AbstractAspectJAdvice.currentJoinPoint().getSignature().getName());
assertEquals(method.getModifiers(), AbstractAspectJAdvice.currentJoinPoint().getSignature().getModifiers());
-
+
MethodSignature msig = (MethodSignature) AbstractAspectJAdvice.currentJoinPoint().getSignature();
assertSame("Return same MethodSignature repeatedly", msig, AbstractAspectJAdvice.currentJoinPoint().getSignature());
assertSame("Return same JoinPoint repeatedly", AbstractAspectJAdvice.currentJoinPoint(), AbstractAspectJAdvice.currentJoinPoint());
@@ -137,7 +137,7 @@ public void testCanGetSourceLocationFromJoinPoint() {
pf.addAdvice(new MethodBeforeAdvice() {
public void before(Method method, Object[] args, Object target) throws Throwable {
SourceLocation sloc = AbstractAspectJAdvice.currentJoinPoint().getSourceLocation();
- assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation());
+ assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation());
assertEquals(TestBean.class, sloc.getWithinType());
try {
sloc.getLine();
@@ -146,7 +146,7 @@ public void before(Method method, Object[] args, Object target) throws Throwable
catch (UnsupportedOperationException ex) {
// Expected
}
-
+
try {
sloc.getFileName();
fail("Can't get file name");
@@ -169,7 +169,7 @@ public void testCanGetStaticPartFromJoinPoint() {
pf.addAdvice(new MethodBeforeAdvice() {
public void before(Method method, Object[] args, Object target) throws Throwable {
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
- assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
+ assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
assertEquals(ProceedingJoinPoint.METHOD_EXECUTION, staticPart.getKind());
assertSame(AbstractAspectJAdvice.currentJoinPoint().getSignature(), staticPart.getSignature());
assertEquals(AbstractAspectJAdvice.currentJoinPoint().getSourceLocation(), staticPart.getSourceLocation());
@@ -191,7 +191,7 @@ public void before(Method method, Object[] args, Object target) throws Throwable
// it serves our purpose here
JoinPoint.StaticPart aspectJVersionJp = Factory.makeEncSJP(method);
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
-
+
assertEquals(aspectJVersionJp.getSignature().toLongString(), jp.getSignature().toLongString());
assertEquals(aspectJVersionJp.getSignature().toShortString(), jp.getSignature().toShortString());
assertEquals(aspectJVersionJp.getSignature().toString(), jp.getSignature().toString());
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java
index 824f51433b63..d9769685c5d4 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java
@@ -38,37 +38,37 @@ public void testAtThis() {
public void testAtTarget() {
assertParameterNames(getMethod("oneAnnotation"),"@target(a)",new String[]{"a"});
}
-
+
@Test
public void testAtArgs() {
assertParameterNames(getMethod("oneAnnotation"),"@args(a)",new String[]{"a"});
}
-
+
@Test
public void testAtWithin() {
assertParameterNames(getMethod("oneAnnotation"),"@within(a)",new String[]{"a"});
}
-
+
@Test
public void testAtWithincode() {
assertParameterNames(getMethod("oneAnnotation"),"@withincode(a)",new String[]{"a"});
}
-
+
@Test
public void testAtAnnotation() {
assertParameterNames(getMethod("oneAnnotation"),"@annotation(a)",new String[]{"a"});
}
-
+
@Test
public void testAmbiguousAnnotationTwoVars() {
assertException(getMethod("twoAnnotations"),"@annotation(a) && @this(x)",AmbiguousBindingException.class,
"Found 2 potential annotation variable(s), and 2 potential argument slots");
}
-
+
@Test
public void testAmbiguousAnnotationOneVar() {
assertException(getMethod("oneAnnotation"),"@annotation(a) && @this(x)",IllegalArgumentException.class,
- "Found 2 candidate annotation binding variables but only one potential argument binding slot");
+ "Found 2 candidate annotation binding variables but only one potential argument binding slot");
}
@Test
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java
index 9877171a60ad..912edf612347 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2005 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
import test.beans.TestBean;
-/**
+/**
* Java5-specific {@link AspectJExpressionPointcutTests}.
*
* @author Rod Johnson
@@ -54,10 +54,10 @@ public void setUp() throws NoSuchMethodException {
methodsOnHasGeneric.put(m.getName(), m);
}
}
-
+
public static class HasGeneric {
-
+
public void setFriends(List friends) {
}
public void setEnemies(List enemies) {
@@ -73,41 +73,42 @@ public void testMatchGenericArgument() {
String expression = "execution(* set*(java.util.List) )";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
-
+
// TODO this will currently map, would be nice for optimization
//assertTrue(ajexp.matches(HasGeneric.class));
//assertFalse(ajexp.matches(TestBean.class));
-
+
Method takesGenericList = methodsOnHasGeneric.get("setFriends");
assertTrue(ajexp.matches(takesGenericList, HasGeneric.class));
assertTrue(ajexp.matches(methodsOnHasGeneric.get("setEnemies"), HasGeneric.class));
assertFalse(ajexp.matches(methodsOnHasGeneric.get("setPartners"), HasGeneric.class));
assertFalse(ajexp.matches(methodsOnHasGeneric.get("setPhoneNumbers"), HasGeneric.class));
-
+
assertFalse(ajexp.matches(getAge, TestBean.class));
}
-
+
@Test
public void testMatchVarargs() throws SecurityException, NoSuchMethodException {
class MyTemplate {
- public int queryForInt(String sql, Object... params) {
- return 0;
- }
+ @SuppressWarnings("unused")
+ public int queryForInt(String sql, Object... params) {
+ return 0;
+ }
}
-
+
String expression = "execution(int *.*(String, Object...))";
AspectJExpressionPointcut jdbcVarArgs = new AspectJExpressionPointcut();
jdbcVarArgs.setExpression(expression);
-
+
// TODO: the expression above no longer matches Object[]
// assertFalse(jdbcVarArgs.matches(
// JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class),
// JdbcTemplate.class));
-
+
assertTrue(jdbcVarArgs.matches(
MyTemplate.class.getMethod("queryForInt", String.class, Object[].class),
MyTemplate.class));
-
+
Method takesGenericList = methodsOnHasGeneric.get("setFriends");
assertFalse(jdbcVarArgs.matches(takesGenericList, HasGeneric.class));
assertFalse(jdbcVarArgs.matches(methodsOnHasGeneric.get("setEnemies"), HasGeneric.class));
@@ -115,44 +116,44 @@ public int queryForInt(String sql, Object... params) {
assertFalse(jdbcVarArgs.matches(methodsOnHasGeneric.get("setPhoneNumbers"), HasGeneric.class));
assertFalse(jdbcVarArgs.matches(getAge, TestBean.class));
}
-
+
@Test
public void testMatchAnnotationOnClassWithAtWithin() throws SecurityException, NoSuchMethodException {
String expression = "@within(test.annotation.transaction.Tx)";
testMatchAnnotationOnClass(expression);
}
-
+
@Test
public void testMatchAnnotationOnClassWithoutBinding() throws SecurityException, NoSuchMethodException {
String expression = "within(@test.annotation.transaction.Tx *)";
testMatchAnnotationOnClass(expression);
}
-
+
@Test
public void testMatchAnnotationOnClassWithSubpackageWildcard() throws SecurityException, NoSuchMethodException {
String expression = "within(@(test.annotation..*) *)";
AspectJExpressionPointcut springAnnotatedPc = testMatchAnnotationOnClass(expression);
- assertFalse(springAnnotatedPc.matches(TestBean.class.getMethod("setName", String.class),
+ assertFalse(springAnnotatedPc.matches(TestBean.class.getMethod("setName", String.class),
TestBean.class));
- assertTrue(springAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null),
+ assertTrue(springAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null),
SpringAnnotated.class));
-
+
expression = "within(@(test.annotation.transaction..*) *)";
AspectJExpressionPointcut springTxAnnotatedPc = testMatchAnnotationOnClass(expression);
- assertFalse(springTxAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null),
+ assertFalse(springTxAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null),
SpringAnnotated.class));
}
-
+
@Test
public void testMatchAnnotationOnClassWithExactPackageWildcard() throws SecurityException, NoSuchMethodException {
String expression = "within(@(test.annotation.transaction.*) *)";
testMatchAnnotationOnClass(expression);
}
-
+
private AspectJExpressionPointcut testMatchAnnotationOnClass(String expression) throws SecurityException, NoSuchMethodException {
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
-
+
assertFalse(ajexp.matches(getAge, TestBean.class));
assertTrue(ajexp.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
assertTrue(ajexp.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
@@ -160,13 +161,13 @@ private AspectJExpressionPointcut testMatchAnnotationOnClass(String expression)
assertFalse(ajexp.matches(BeanA.class.getMethod("setName", String.class), BeanA.class));
return ajexp;
}
-
+
@Test
public void testAnnotationOnMethodWithFQN() throws SecurityException, NoSuchMethodException {
String expression = "@annotation(test.annotation.transaction.Tx)";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
-
+
assertFalse(ajexp.matches(getAge, TestBean.class));
assertFalse(ajexp.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
assertFalse(ajexp.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
@@ -174,13 +175,13 @@ public void testAnnotationOnMethodWithFQN() throws SecurityException, NoSuchMeth
assertTrue(ajexp.matches(BeanA.class.getMethod("getAge", (Class[]) null), BeanA.class));
assertFalse(ajexp.matches(BeanA.class.getMethod("setName", String.class), BeanA.class));
}
-
+
@Test
public void testAnnotationOnMethodWithWildcard() throws SecurityException, NoSuchMethodException {
String expression = "execution(@(test.annotation..*) * *(..))";
AspectJExpressionPointcut anySpringMethodAnnotation = new AspectJExpressionPointcut();
anySpringMethodAnnotation.setExpression(expression);
-
+
assertFalse(anySpringMethodAnnotation.matches(getAge, TestBean.class));
assertFalse(anySpringMethodAnnotation.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
assertFalse(anySpringMethodAnnotation.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
@@ -194,43 +195,43 @@ public void testAnnotationOnMethodArgumentsWithFQN() throws SecurityException, N
String expression = "@args(*, test.annotation.EmptySpringAnnotation))";
AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut();
takesSpringAnnotatedArgument2.setExpression(expression);
-
+
assertFalse(takesSpringAnnotatedArgument2.matches(getAge, TestBean.class));
assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class));
assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("getAge", (Class[]) null), BeanA.class));
assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class));
-
+
assertTrue(takesSpringAnnotatedArgument2.matches(
ProcessesSpringAnnotatedParameters.class.getMethod("takesAnnotatedParameters", TestBean.class, SpringAnnotated.class),
ProcessesSpringAnnotatedParameters.class));
-
+
// True because it maybeMatches with potential argument subtypes
assertTrue(takesSpringAnnotatedArgument2.matches(
ProcessesSpringAnnotatedParameters.class.getMethod("takesNoAnnotatedParameters", TestBean.class, BeanA.class),
ProcessesSpringAnnotatedParameters.class));
-
+
assertFalse(takesSpringAnnotatedArgument2.matches(
ProcessesSpringAnnotatedParameters.class.getMethod("takesNoAnnotatedParameters", TestBean.class, BeanA.class),
ProcessesSpringAnnotatedParameters.class,
new Object[] { new TestBean(), new BeanA()})
);
}
-
+
@Test
public void testAnnotationOnMethodArgumentsWithWildcards() throws SecurityException, NoSuchMethodException {
String expression = "execution(* *(*, @(test..*) *))";
AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut();
takesSpringAnnotatedArgument2.setExpression(expression);
-
+
assertFalse(takesSpringAnnotatedArgument2.matches(getAge, TestBean.class));
assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class));
assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("getAge", (Class[]) null), BeanA.class));
assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class));
-
+
assertTrue(takesSpringAnnotatedArgument2.matches(
ProcessesSpringAnnotatedParameters.class.getMethod("takesAnnotatedParameters", TestBean.class, SpringAnnotated.class),
ProcessesSpringAnnotatedParameters.class));
@@ -267,8 +268,9 @@ public void foo() {
}
}
-
+
static class BeanA {
+ @SuppressWarnings("unused")
private String name;
private int age;
@@ -283,9 +285,10 @@ public int getAge() {
}
}
-
+
@Tx
static class BeanB {
+ @SuppressWarnings("unused")
private String name;
public void setName(String name) {
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java
index 227c1553c317..cb78cd56f750 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java
@@ -67,7 +67,7 @@ public void testManualProxyJavaWithStaticPointcutAndTwoClassLoaders() throws Exc
// Test with default class loader first...
testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, new TestServiceImpl(), "TestServiceImpl");
-
+
// Then try again with a different class loader on the target...
SimpleThrowawayClassLoader loader = new SimpleThrowawayClassLoader(new TestServiceImpl().getClass().getClassLoader());
// Make sure the interface is loaded from the parent class loader
@@ -102,7 +102,7 @@ private void testAdvice(Advisor advisor, LogUserAdvice logAdvice, TestService ta
}
assertEquals(1, logAdvice.getCountThrows());
}
-
+
public static class SimpleThrowawayClassLoader extends OverridingClassLoader {
/**
@@ -114,7 +114,7 @@ public SimpleThrowawayClassLoader(ClassLoader parent) {
}
}
-
+
public static class TestException extends RuntimeException {
public TestException(String string) {
@@ -129,32 +129,32 @@ public TestException(String string) {
@Inherited
public static @interface Log {
}
-
+
public static interface TestService {
- public String sayHello();
+ public String sayHello();
}
-
+
@Log
public static class TestServiceImpl implements TestService{
- public String sayHello() {
- throw new TestException("TestServiceImpl");
- }
+ public String sayHello() {
+ throw new TestException("TestServiceImpl");
+ }
}
public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice {
-
+
private int countBefore = 0;
-
+
private int countThrows = 0;
-
+
public void before(Method method, Object[] objects, Object o) throws Throwable {
countBefore++;
- }
+ }
public void afterThrowing(Exception e) throws Throwable {
countThrows++;
- throw e;
- }
+ throw e;
+ }
public int getCountBefore() {
return countBefore;
@@ -163,12 +163,12 @@ public int getCountBefore() {
public int getCountThrows() {
return countThrows;
}
-
+
public void reset() {
countThrows = 0;
countBefore = 0;
}
}
-
+
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java
index c3708d6b86cc..fea874179e00 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ public void testSubclassMatching() {
assertFalse("Must be excluded: not subclass", tpcf.matches(IOther.class));
assertFalse("Must be excluded: not subclass", tpcf.matches(DefaultListableBeanFactory.class));
}
-
+
@Test
public void testAndOrNotReplacement() {
TypePatternClassFilter tpcf = new TypePatternClassFilter("java.lang.Object or java.lang.String");
@@ -75,12 +75,12 @@ public void testAndOrNotReplacement() {
assertFalse("matches Double",tpcf.matches(Double.class));
tpcf = new TypePatternClassFilter("java.lang.Number+ and not java.lang.Float");
assertFalse("matches Float",tpcf.matches(Float.class));
- assertTrue("matches Double",tpcf.matches(Double.class));
+ assertTrue("matches Double",tpcf.matches(Double.class));
}
@Test(expected=IllegalArgumentException.class)
public void testSetTypePatternWithNullArgument() throws Exception {
- new TypePatternClassFilter(null);
+ new TypePatternClassFilter(null);
}
@Test(expected=IllegalStateException.class)
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java
index 1c366a70425c..ce569e3b01c0 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java
@@ -76,7 +76,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
* @return the fixture
*/
protected abstract AspectJAdvisorFactory getFixture();
-
+
@Test
public void testRejectsPerCflowAspect() {
@@ -88,7 +88,7 @@ public void testRejectsPerCflowAspect() {
assertTrue(ex.getMessage().indexOf("PERCFLOW") != -1);
}
}
-
+
@Test
public void testRejectsPerCflowBelowAspect() {
try {
@@ -105,11 +105,11 @@ public void testPerTargetAspect() throws SecurityException, NoSuchMethodExceptio
TestBean target = new TestBean();
int realAge = 65;
target.setAge(realAge);
- TestBean itb = (TestBean) createProxy(target,
+ TestBean itb = (TestBean) createProxy(target,
getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new PerTargetAspect(), "someBean")),
TestBean.class);
assertEquals("Around advice must NOT apply", realAge, itb.getAge());
-
+
Advised advised = (Advised) itb;
SyntheticInstantiationAdvisor sia = (SyntheticInstantiationAdvisor) advised.getAdvisors()[1];
assertTrue(sia.getPointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null));
@@ -121,10 +121,10 @@ public void testPerTargetAspect() throws SecurityException, NoSuchMethodExceptio
// Check that the perclause pointcut is valid
assertTrue(maaif.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null));
assertNotSame(imapa.getDeclaredPointcut(), imapa.getPointcut());
-
+
// Hit the method in the per clause to instantiate the aspect
itb.getSpouse();
-
+
assertTrue(maaif.isMaterialized());
assertEquals("Around advice must apply", 0, itb.getAge());
@@ -190,11 +190,11 @@ public void testPerThisAspect() throws SecurityException, NoSuchMethodException
TestBean target = new TestBean();
int realAge = 65;
target.setAge(realAge);
- TestBean itb = (TestBean) createProxy(target,
+ TestBean itb = (TestBean) createProxy(target,
getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new PerThisAspect(), "someBean")),
TestBean.class);
assertEquals("Around advice must NOT apply", realAge, itb.getAge());
-
+
Advised advised = (Advised) itb;
// Will be ExposeInvocationInterceptor, synthetic instantiation advisor, 2 method advisors
assertEquals(4, advised.getAdvisors().length);
@@ -208,30 +208,30 @@ public void testPerThisAspect() throws SecurityException, NoSuchMethodException
// Check that the perclause pointcut is valid
assertTrue(maaif.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null));
assertNotSame(imapa.getDeclaredPointcut(), imapa.getPointcut());
-
+
// Hit the method in the per clause to instantiate the aspect
itb.getSpouse();
-
+
assertTrue(maaif.isMaterialized());
assertTrue(imapa.getDeclaredPointcut().getMethodMatcher().matches(TestBean.class.getMethod("getAge"), null));
-
+
assertEquals("Around advice must apply", 0, itb.getAge());
assertEquals("Around advice must apply", 1, itb.getAge());
}
-
+
@Test
public void testPerTypeWithinAspect() throws SecurityException, NoSuchMethodException {
TestBean target = new TestBean();
int realAge = 65;
target.setAge(realAge);
PerTypeWithinAspectInstanceFactory aif = new PerTypeWithinAspectInstanceFactory();
- TestBean itb = (TestBean) createProxy(target,
- getFixture().getAdvisors(aif),
+ TestBean itb = (TestBean) createProxy(target,
+ getFixture().getAdvisors(aif),
TestBean.class);
assertEquals("No method calls", 0, aif.getInstantiationCount());
assertEquals("Around advice must now apply", 0, itb.getAge());
-
+
Advised advised = (Advised) itb;
// Will be ExposeInvocationInterceptor, synthetic instantiation advisor, 2 method advisors
assertEquals(4, advised.getAdvisors().length);
@@ -245,19 +245,19 @@ public void testPerTypeWithinAspect() throws SecurityException, NoSuchMethodExce
// Check that the perclause pointcut is valid
assertTrue(maaif.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null));
assertNotSame(imapa.getDeclaredPointcut(), imapa.getPointcut());
-
+
// Hit the method in the per clause to instantiate the aspect
itb.getSpouse();
-
+
assertTrue(maaif.isMaterialized());
assertTrue(imapa.getDeclaredPointcut().getMethodMatcher().matches(TestBean.class.getMethod("getAge"), null));
-
+
assertEquals("Around advice must still apply", 1, itb.getAge());
assertEquals("Around advice must still apply", 2, itb.getAge());
-
- TestBean itb2 = (TestBean) createProxy(target,
- getFixture().getAdvisors(aif),
+
+ TestBean itb2 = (TestBean) createProxy(target,
+ getFixture().getAdvisors(aif),
TestBean.class);
assertEquals(1, aif.getInstantiationCount());
assertEquals("Around advice be independent for second instance", 0, itb2.getAge());
@@ -282,20 +282,20 @@ public void testNamedPointcutFromAspectLibrary() {
@Test
public void testNamedPointcutFromAspectLibraryWithBinding() {
TestBean target = new TestBean();
- ITestBean itb = (ITestBean) createProxy(target,
- getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new NamedPointcutAspectFromLibraryWithBinding(),"someBean")),
+ ITestBean itb = (ITestBean) createProxy(target,
+ getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new NamedPointcutAspectFromLibraryWithBinding(),"someBean")),
ITestBean.class);
itb.setAge(10);
assertEquals("Around advice must apply", 20, itb.getAge());
assertEquals(20,target.getAge());
}
-
+
private void testNamedPointcuts(Object aspectInstance) {
TestBean target = new TestBean();
int realAge = 65;
target.setAge(realAge);
- ITestBean itb = (ITestBean) createProxy(target,
- getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(aspectInstance,"someBean")),
+ ITestBean itb = (ITestBean) createProxy(target,
+ getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(aspectInstance,"someBean")),
ITestBean.class);
assertEquals("Around advice must apply", -1, itb.getAge());
assertEquals(realAge, target.getAge());
@@ -304,8 +304,8 @@ private void testNamedPointcuts(Object aspectInstance) {
@Test
public void testBindingWithSingleArg() {
TestBean target = new TestBean();
- ITestBean itb = (ITestBean) createProxy(target,
- getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new BindingAspectWithSingleArg(),"someBean")),
+ ITestBean itb = (ITestBean) createProxy(target,
+ getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new BindingAspectWithSingleArg(),"someBean")),
ITestBean.class);
itb.setAge(10);
assertEquals("Around advice must apply", 20, itb.getAge());
@@ -315,10 +315,10 @@ public void testBindingWithSingleArg() {
@Test
public void testBindingWithMultipleArgsDifferentlyOrdered() {
ManyValuedArgs target = new ManyValuedArgs();
- ManyValuedArgs mva = (ManyValuedArgs) createProxy(target,
- getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ManyValuedArgs(),"someBean")),
+ ManyValuedArgs mva = (ManyValuedArgs) createProxy(target,
+ getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ManyValuedArgs(),"someBean")),
ManyValuedArgs.class);
-
+
String a = "a";
int b = 12;
int c = 25;
@@ -327,7 +327,7 @@ public void testBindingWithMultipleArgsDifferentlyOrdered() {
String expectedResult = a + b+ c + d + e;
assertEquals(expectedResult, mva.mungeArgs(a, b, c, d, e));
}
-
+
/**
* In this case the introduction will be made.
*/
@@ -344,7 +344,7 @@ public void testIntroductionOnTargetNotImplementingInterface() {
assertFalse(lockable.locked());
lockable.lock();
assertTrue(lockable.locked());
-
+
NotLockable notLockable2Target = new NotLockable();
NotLockable notLockable2 = (NotLockable) createProxy(notLockable2Target,
getFixture().getAdvisors(
@@ -363,17 +363,17 @@ public void testIntroductionOnTargetNotImplementingInterface() {
}
assertTrue(lockable2.locked());
}
-
+
@Test
public void testIntroductionAdvisorExcludedFromTargetImplementingInterface() {
assertTrue(AopUtils.findAdvisorsThatCanApply(
getFixture().getAdvisors(
new SingletonMetadataAwareAspectInstanceFactory(
- new MakeLockable(),"someBean")),
+ new MakeLockable(),"someBean")),
CannotBeUnlocked.class).isEmpty());
assertEquals(2, AopUtils.findAdvisorsThatCanApply(getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new MakeLockable(),"someBean")), NotLockable.class).size());
}
-
+
@Test
public void testIntroductionOnTargetImplementingInterface() {
CannotBeUnlocked target = new CannotBeUnlocked();
@@ -385,25 +385,23 @@ public void testIntroductionOnTargetImplementingInterface() {
CannotBeUnlocked.class
),
CannotBeUnlocked.class);
- assertTrue(proxy instanceof Lockable);
- Lockable lockable = (Lockable) proxy;
- assertTrue("Already locked", lockable.locked());
- lockable.lock();
- assertTrue("Real target ignores locking", lockable.locked());
+ assertTrue("Already locked", proxy.locked());
+ proxy.lock();
+ assertTrue("Real target ignores locking", proxy.locked());
try {
- lockable.unlock();
+ proxy.unlock();
fail();
}
catch (UnsupportedOperationException ex) {
// Ok
}
}
-
+
@SuppressWarnings("unchecked")
@Test
public void testIntroductionOnTargetExcludedByTypePattern() {
- LinkedList target = new LinkedList();
- List proxy = (List) createProxy(target,
+ LinkedList target = new LinkedList();
+ List proxy = (List) createProxy(target,
AopUtils.findAdvisorsThatCanApply(
getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new MakeLockable(), "someBean")),
List.class
@@ -415,7 +413,7 @@ public void testIntroductionOnTargetExcludedByTypePattern() {
@Test
public void testIntroductionBasedOnAnnotationMatch_Spr5307() {
AnnotatedTarget target = new AnnotatedTargetImpl();
-
+
List advisors = getFixture().getAdvisors(
new SingletonMetadataAwareAspectInstanceFactory(new MakeAnnotatedTypeModifiable(),"someBean"));
Object proxy = createProxy(target,
@@ -426,23 +424,22 @@ public void testIntroductionBasedOnAnnotationMatch_Spr5307() {
Lockable lockable = (Lockable)proxy;
lockable.locked();
}
- */
+ */
// TODO: Why does this test fail? It hasn't been run before, so it maybe never actually passed...
public void XtestIntroductionWithArgumentBinding() {
TestBean target = new TestBean();
-
+
List advisors = getFixture().getAdvisors(
new SingletonMetadataAwareAspectInstanceFactory(new MakeITestBeanModifiable(),"someBean"));
advisors.addAll(getFixture().getAdvisors(
new SingletonMetadataAwareAspectInstanceFactory(new MakeLockable(),"someBean")));
-
+
Modifiable modifiable = (Modifiable) createProxy(target,
advisors,
ITestBean.class);
- assertTrue(modifiable instanceof Modifiable);
Lockable lockable = (Lockable) modifiable;
assertFalse(lockable.locked());
-
+
ITestBean itb = (ITestBean) modifiable;
assertFalse(modifiable.isModified());
int oldAge = itb.getAge();
@@ -454,7 +451,7 @@ public void XtestIntroductionWithArgumentBinding() {
assertFalse("Setting same value does not modify", modifiable.isModified());
itb.setName("And now for something completely different");
assertTrue(modifiable.isModified());
-
+
lockable.lock();
assertTrue(lockable.locked());
try {
@@ -474,8 +471,8 @@ public void testAspectMethodThrowsExceptionLegalOnSignature() {
UnsupportedOperationException expectedException = new UnsupportedOperationException();
List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ExceptionAspect(expectedException),"someBean"));
assertEquals("One advice method was found", 1, advisors.size());
- ITestBean itb = (ITestBean) createProxy(target,
- advisors,
+ ITestBean itb = (ITestBean) createProxy(target,
+ advisors,
ITestBean.class);
try {
itb.getAge();
@@ -485,7 +482,7 @@ public void testAspectMethodThrowsExceptionLegalOnSignature() {
assertSame(expectedException, ex);
}
}
-
+
// TODO document this behaviour.
// Is it different AspectJ behaviour, at least for checked exceptions?
@Test
@@ -494,8 +491,8 @@ public void testAspectMethodThrowsExceptionIllegalOnSignature() {
RemoteException expectedException = new RemoteException();
List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ExceptionAspect(expectedException),"someBean"));
assertEquals("One advice method was found", 1, advisors.size());
- ITestBean itb = (ITestBean) createProxy(target,
- advisors,
+ ITestBean itb = (ITestBean) createProxy(target,
+ advisors,
ITestBean.class);
try {
itb.getAge();
@@ -505,7 +502,7 @@ public void testAspectMethodThrowsExceptionIllegalOnSignature() {
assertSame(expectedException, ex.getCause());
}
}
-
+
protected Object createProxy(Object target, List advisors, Class>... interfaces) {
ProxyFactory pf = new ProxyFactory(target);
if (interfaces.length > 1 || interfaces[0].isInterface()) {
@@ -533,8 +530,8 @@ public void testTwoAdvicesOnOneAspect() {
TwoAdviceAspect twoAdviceAspect = new TwoAdviceAspect();
List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(twoAdviceAspect,"someBean"));
assertEquals("Two advice methods found", 2, advisors.size());
- ITestBean itb = (ITestBean) createProxy(target,
- advisors,
+ ITestBean itb = (ITestBean) createProxy(target,
+ advisors,
ITestBean.class);
itb.setName("");
assertEquals(0, itb.getAge());
@@ -549,8 +546,8 @@ public void testAfterAdviceTypes() throws Exception {
ExceptionHandling afterReturningAspect = new ExceptionHandling();
List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(afterReturningAspect,"someBean"));
- Echo echo = (Echo) createProxy(target,
- advisors,
+ Echo echo = (Echo) createProxy(target,
+ advisors,
Echo.class);
assertEquals(0, afterReturningAspect.successCount);
assertEquals("", echo.echo(""));
@@ -574,20 +571,31 @@ public void testAfterAdviceTypes() throws Exception {
@Test
public void testFailureWithoutExplicitDeclarePrecedence() {
TestBean target = new TestBean();
- MetadataAwareAspectInstanceFactory aspectInstanceFactory = new SingletonMetadataAwareAspectInstanceFactory(
- new NoDeclarePrecedenceShouldFail(), "someBean");
ITestBean itb = (ITestBean) createProxy(target,
- getFixture().getAdvisors(aspectInstanceFactory), ITestBean.class);
- itb.getAge();
+ getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new NoDeclarePrecedenceShouldFail(), "someBean")),
+ ITestBean.class);
+ try {
+ itb.getAge();
+ fail();
+ }
+ catch (IllegalStateException ex) {
+ // expected
+ }
}
- @Test(expected=IllegalArgumentException.class)
+ @Test
public void testDeclarePrecedenceNotSupported() {
TestBean target = new TestBean();
- MetadataAwareAspectInstanceFactory aspectInstanceFactory = new SingletonMetadataAwareAspectInstanceFactory(
- new DeclarePrecedenceShouldSucceed(), "someBean");
- createProxy(target, getFixture().getAdvisors(aspectInstanceFactory),
- ITestBean.class);
+ try {
+ createProxy(target,
+ getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(
+ new DeclarePrecedenceShouldSucceed(),"someBean")),
+ ITestBean.class);
+ fail();
+ }
+ catch (IllegalArgumentException ex) {
+ // Not supported in 2.0
+ }
}
/** Not supported in 2.0!
@@ -694,6 +702,7 @@ public int getOrder() {
@Aspect
public static class NamedPointcutAspectWithFQN {
+ @SuppressWarnings("unused")
private ITestBean fieldThatShouldBeIgnoredBySpringAtAspectJProcessing = new TestBean();
@Pointcut("execution(* getAge())")
@@ -886,47 +895,47 @@ public int preventExecution(ProceedingJoinPoint pjp) {
*/
@Aspect
abstract class AbstractMakeModifiable {
-
+
public interface MutableModifable extends Modifiable {
void markDirty();
}
-
+
public static class ModifiableImpl implements MutableModifable {
private boolean modified;
-
+
public void acceptChanges() {
modified = false;
}
-
+
public boolean isModified() {
return modified;
}
-
+
public void markDirty() {
this.modified = true;
}
}
-
- @Before(value="execution(void set*(*)) && this(modifiable) && args(newValue)",
+
+ @Before(value="execution(void set*(*)) && this(modifiable) && args(newValue)",
argNames="modifiable,newValue")
- public void recordModificationIfSetterArgumentDiffersFromOldValue(JoinPoint jp,
+ public void recordModificationIfSetterArgumentDiffersFromOldValue(JoinPoint jp,
MutableModifable mixin, Object newValue) {
-
+
/*
* We use the mixin to check and, if necessary, change,
- * modification status. We need the JoinPoint to get the
- * setter method. We use newValue for comparison.
+ * modification status. We need the JoinPoint to get the
+ * setter method. We use newValue for comparison.
* We try to invoke the getter if possible.
*/
-
+
if (mixin.isModified()) {
// Already changed, don't need to change again
//System.out.println("changed");
return;
}
-
+
// Find the current raw value, by invoking the corresponding setter
- Method correspondingGetter = getGetterFromSetter(((MethodSignature) jp.getSignature()).getMethod());
+ Method correspondingGetter = getGetterFromSetter(((MethodSignature) jp.getSignature()).getMethod());
boolean modified = true;
if (correspondingGetter != null) {
try {
@@ -946,12 +955,12 @@ public void recordModificationIfSetterArgumentDiffersFromOldValue(JoinPoint jp,
mixin.markDirty();
}
}
-
+
private Method getGetterFromSetter(Method setter) {
String getterName = setter.getName().replaceFirst("set", "get");
try {
return setter.getDeclaringClass().getMethod(getterName, (Class[]) null);
- }
+ }
catch (NoSuchMethodException ex) {
// must be write only
return null;
@@ -968,7 +977,7 @@ private Method getGetterFromSetter(Method setter) {
*/
@Aspect
class MakeITestBeanModifiable extends AbstractMakeModifiable {
-
+
@DeclareParents(value = "test.beans.ITestBean+",
defaultImpl=ModifiableImpl.class)
public static MutableModifable mixin;
@@ -982,7 +991,7 @@ class MakeITestBeanModifiable extends AbstractMakeModifiable {
*/
@Aspect
class MakeAnnotatedTypeModifiable extends AbstractMakeModifiable {
-
+
@DeclareParents(value = "(@org.springframework.aop.aspectj.annotation.Measured *)",
// @DeclareParents(value = "(@Measured *)", // this would be a nice alternative...
defaultImpl=DefaultLockable.class)
@@ -996,11 +1005,11 @@ class MakeAnnotatedTypeModifiable extends AbstractMakeModifiable {
*/
@Aspect
class MakeLockable {
-
+
@DeclareParents(value = "org.springframework..*",
defaultImpl=DefaultLockable.class)
public static Lockable mixin;
-
+
@Before(value="execution(void set*(*)) && this(mixin)", argNames="mixin")
public void checkNotLocked(
Lockable mixin) // Bind to arg
@@ -1043,9 +1052,9 @@ public int compareTo(Object arg0) {
interface Modifiable {
boolean isModified();
-
+
void acceptChanges();
-
+
}
/**
@@ -1057,14 +1066,14 @@ interface AnnotatedTarget {
@Measured
class AnnotatedTargetImpl implements AnnotatedTarget {
-
+
}
@Retention(RetentionPolicy.RUNTIME)
@interface Measured {}
class NotLockable {
-
+
private int intValue;
public int getIntValue() {
@@ -1086,6 +1095,7 @@ class PerThisAspect {
/**
* Just to check that this doesn't cause problems with introduction processing
*/
+ @SuppressWarnings("unused")
private ITestBean fieldThatShouldBeIgnoredBySpringAtAspectJProcessing = new TestBean();
@Around("execution(int *.getAge())")
@@ -1097,5 +1107,5 @@ public int returnCountAsAge() {
public void countSetter() {
++count;
}
-
+
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java
index 5f108cb56da4..17eb415a0417 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public void testBindingInPointcutUsedByAdvice() {
TestBean tb = new TestBean();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb);
proxyFactory.addAspect(NamedPointcutWithArgs.class);
-
+
ITestBean proxiedTestBean = (ITestBean) proxyFactory.getProxy();
proxiedTestBean.setName("Supercalifragalisticexpialidocious"); // should throw
}
@@ -54,7 +54,7 @@ public void testAnnotationArgumentNameBinding() {
TransactionalBean tb = new TransactionalBean();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb);
proxyFactory.addAspect(PointcutWithAnnotationArgument.class);
-
+
ITransactionalBean proxiedTestBean = (ITransactionalBean) proxyFactory.getProxy();
proxiedTestBean.doInTransaction(); // should throw
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java
index ead9f1f62cc1..88beb1455a50 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,56 +29,56 @@
/**
- * @author Rod Johnson
+ * @author Rod Johnson
* @author Chris Beams
*/
public final class AspectJPointcutAdvisorTests {
-
+
private AspectJAdvisorFactory af = new ReflectiveAspectJAdvisorFactory();
@Test
public void testSingleton() throws SecurityException, NoSuchMethodException {
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS);
-
- InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp,
- new SingletonMetadataAwareAspectInstanceFactory(new AbstractAspectJAdvisorFactoryTests.ExceptionAspect(null),"someBean"),
+
+ InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp,
+ new SingletonMetadataAwareAspectInstanceFactory(new AbstractAspectJAdvisorFactoryTests.ExceptionAspect(null),"someBean"),
TestBean.class.getMethod("getAge", (Class[]) null),1,"someBean");
assertSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut());
assertFalse(ajpa.isPerInstance());
}
-
+
@Test
public void testPerTarget() throws SecurityException, NoSuchMethodException {
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS);
-
- InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp,
+
+ InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp,
new SingletonMetadataAwareAspectInstanceFactory(new PerTargetAspect(),"someBean"), null, 1, "someBean");
assertNotSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut());
assertTrue(ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut);
assertTrue(ajpa.isPerInstance());
-
+
assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getClassFilter().matches(TestBean.class));
assertFalse(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(
TestBean.class.getMethod("getAge", (Class[]) null),
TestBean.class));
-
+
assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(
TestBean.class.getMethod("getSpouse", (Class[]) null),
TestBean.class));
}
-
+
@Test(expected=AopConfigException.class)
public void testPerCflowTarget() {
testIllegalInstantiationModel(AbstractAspectJAdvisorFactoryTests.PerCflowAspect.class);
}
-
+
@Test(expected=AopConfigException.class)
public void testPerCflowBelowTarget() {
testIllegalInstantiationModel(AbstractAspectJAdvisorFactoryTests.PerCflowBelowAspect.class);
}
-
+
private void testIllegalInstantiationModel(Class> c) throws AopConfigException {
new AspectMetadata(c,"someBean");
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java
index f1c32fe992ea..af55e122a63c 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public final class AspectMetadataTests {
public void testNotAnAspect() {
new AspectMetadata(String.class,"someBean");
}
-
+
@Test
public void testSingletonAspect() {
AspectMetadata am = new AspectMetadata(ExceptionAspect.class,"someBean");
@@ -45,7 +45,7 @@ public void testSingletonAspect() {
assertSame(Pointcut.TRUE, am.getPerClausePointcut());
assertEquals(PerClauseKind.SINGLETON, am.getAjType().getPerClause().getKind());
}
-
+
@Test
public void testPerTargetAspect() {
AspectMetadata am = new AspectMetadata(PerTargetAspect.class,"someBean");
@@ -53,7 +53,7 @@ public void testPerTargetAspect() {
assertNotSame(Pointcut.TRUE, am.getPerClausePointcut());
assertEquals(PerClauseKind.PERTARGET, am.getAjType().getPerClause().getKind());
}
-
+
@Test
public void testPerThisAspect() {
AspectMetadata am = new AspectMetadata(PerThisAspect.class,"someBean");
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java
index d6c24cd0a106..ecbd1b0c14cb 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java
index 9cb01199f061..085e8c5d9f51 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java
@@ -17,7 +17,7 @@
package org.springframework.aop.aspectj.annotation;
/**
- * Tests for ReflectiveAtAspectJAdvisorFactory.
+ * Tests for ReflectiveAtAspectJAdvisorFactory.
* Tests are inherited: we only set the test fixture here.
*
* @author Rod Johnson
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java
index 6b7d3ff09656..0dc4555c0724 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java
index 0869a1fa02dd..9a65ae7c8fbd 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,9 +42,9 @@
public final class AspectJPrecedenceComparatorTests {
/*
- * Specification for the comparator (as defined in the
+ * Specification for the comparator (as defined in the
* AspectJPrecedenceComparator class)
- *
+ *
*
* Orders AspectJ advice/advisors by invocation order.
*
diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java
index de36eb98b631..0d86588b8c94 100644
--- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,18 +43,18 @@
public final class AopNamespaceHandlerEventTests {
private static final Class> CLASS = AopNamespaceHandlerEventTests.class;
-
+
private static final Resource CONTEXT = qualifiedResource(CLASS, "context.xml");
private static final Resource POINTCUT_EVENTS_CONTEXT = qualifiedResource(CLASS, "pointcutEvents.xml");
private static final Resource POINTCUT_REF_CONTEXT = qualifiedResource(CLASS, "pointcutRefEvents.xml");
private static final Resource DIRECT_POINTCUT_EVENTS_CONTEXT = qualifiedResource(CLASS, "directPointcutEvents.xml");
-
+
private CollectingReaderEventListener eventListener = new CollectingReaderEventListener();
private XmlBeanDefinitionReader reader;
private DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
-
+
@Before
diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java
index 860e3dd0ba85..b7754b693ecd 100644
--- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,26 +17,24 @@
package org.springframework.aop.config;
import static org.junit.Assert.*;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.junit.Test;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
/**
* @author Mark Fisher
* @author Chris Beams
*/
public final class AopNamespaceHandlerPointcutErrorTests {
-
+
@Test
public void testDuplicatePointcutConfig() {
try {
- new XmlBeanFactory(qualifiedResource(getClass(), "pointcutDuplication.xml"));
+ beanFactoryFromQualifiedResource(getClass(), "pointcutDuplication.xml");
fail("parsing should have caused a BeanDefinitionStoreException");
- }
- catch (BeanDefinitionStoreException ex) {
+ } catch (BeanDefinitionStoreException ex) {
assertTrue(ex.contains(BeanDefinitionParsingException.class));
}
}
@@ -44,7 +42,7 @@ public void testDuplicatePointcutConfig() {
@Test
public void testMissingPointcutConfig() {
try {
- new XmlBeanFactory(qualifiedResource(getClass(), "pointcutMissing.xml"));
+ beanFactoryFromQualifiedResource(getClass(), "pointcutMissing.xml");
fail("parsing should have caused a BeanDefinitionStoreException");
}
catch (BeanDefinitionStoreException ex) {
diff --git a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java
index 353df218fa47..40209c7d7bf0 100644
--- a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java
@@ -26,12 +26,12 @@
/**
* Tests that the <aop:config/> element can be used as a top level element.
- *
+ *
* @author Rob Harrop
* @author Chris Beams
*/
public final class TopLevelAopTagTests {
-
+
private static final Resource CONTEXT = qualifiedResource(TopLevelAopTagTests.class, "context.xml");
@Test
diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java
index dda6cf20b1aa..75eadcf99ab1 100644
--- a/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
* @author Chris Beams
*/
public final class AopProxyUtilsTests {
-
+
@Test
public void testCompleteProxiedInterfacesWorksWithNull() {
AdvisedSupport as = new AdvisedSupport();
@@ -45,7 +45,7 @@ public void testCompleteProxiedInterfacesWorksWithNull() {
assertTrue(ifaces.contains(Advised.class));
assertTrue(ifaces.contains(SpringProxy.class));
}
-
+
@Test
public void testCompleteProxiedInterfacesWorksWithNullOpaque() {
AdvisedSupport as = new AdvisedSupport();
@@ -53,7 +53,7 @@ public void testCompleteProxiedInterfacesWorksWithNullOpaque() {
Class>[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as);
assertEquals(1, completedInterfaces.length);
}
-
+
@Test
public void testCompleteProxiedInterfacesAdvisedNotIncluded() {
AdvisedSupport as = new AdvisedSupport();
@@ -61,14 +61,14 @@ public void testCompleteProxiedInterfacesAdvisedNotIncluded() {
as.addInterface(Comparable.class);
Class>[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as);
assertEquals(4, completedInterfaces.length);
-
+
// Can't assume ordering for others, so use a list
List> l = Arrays.asList(completedInterfaces);
assertTrue(l.contains(Advised.class));
assertTrue(l.contains(ITestBean.class));
assertTrue(l.contains(Comparable.class));
}
-
+
@Test
public void testCompleteProxiedInterfacesAdvisedIncluded() {
AdvisedSupport as = new AdvisedSupport();
@@ -77,14 +77,14 @@ public void testCompleteProxiedInterfacesAdvisedIncluded() {
as.addInterface(Advised.class);
Class>[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as);
assertEquals(4, completedInterfaces.length);
-
+
// Can't assume ordering for others, so use a list
List> l = Arrays.asList(completedInterfaces);
assertTrue(l.contains(Advised.class));
assertTrue(l.contains(ITestBean.class));
assertTrue(l.contains(Comparable.class));
}
-
+
@Test
public void testCompleteProxiedInterfacesAdvisedNotIncludedOpaque() {
AdvisedSupport as = new AdvisedSupport();
@@ -93,7 +93,7 @@ public void testCompleteProxiedInterfacesAdvisedNotIncludedOpaque() {
as.addInterface(Comparable.class);
Class>[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as);
assertEquals(3, completedInterfaces.length);
-
+
// Can't assume ordering for others, so use a list
List> l = Arrays.asList(completedInterfaces);
assertFalse(l.contains(Advised.class));
@@ -136,4 +136,4 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
AopProxyUtils.proxiedUserInterfaces(proxy);
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java
index a8623ba81c74..9de89648053c 100644
--- a/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2008 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,9 +25,9 @@
/**
* Benchmarks for introductions.
- *
+ *
* NOTE: No assertions!
- *
+ *
* @author Rod Johnson
* @author Chris Beams
* @since 2.0
diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java
index 4fdbbc0126b8..883fdde9721c 100644
--- a/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@
* @since 14.03.2003
*/
public final class MethodInvocationTests {
-
+
@Test
public void testValidInvocation() throws Throwable {
Method m = Object.class.getMethod("hashCode", (Class[]) null);
@@ -52,7 +52,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable {
Object rv = invocation.proceed();
assertTrue("correct response", rv == returnValue);
}
-
+
/**
* toString on target can cause failure.
*/
@@ -68,7 +68,7 @@ public String toString() {
Method m = Object.class.getMethod("hashCode", (Class[]) null);
Object proxy = new Object();
ReflectiveMethodInvocation invocation =
- new ReflectiveMethodInvocation(proxy, target, m, null, null, is);
+ new ReflectiveMethodInvocation(proxy, target, m, null, null, is);
// If it hits target, the test will fail with the UnsupportedOpException
// in the inner class above.
diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java
index fd4eae3a7fb4..59f27fb0bfd7 100644
--- a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,13 +17,12 @@
package org.springframework.aop.framework;
import static org.junit.Assert.assertEquals;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
+import org.springframework.beans.factory.BeanFactory;
/**
* @author Juergen Hoeller
@@ -31,36 +30,30 @@
* @since 03.09.2004
*/
public final class PrototypeTargetTests {
-
- private static final Resource CONTEXT = qualifiedResource(PrototypeTargetTests.class, "context.xml");
@Test
public void testPrototypeProxyWithPrototypeTarget() {
- TestBeanImpl.constructionCount = 0;
- XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
- for (int i = 0; i < 10; i++) {
- TestBean tb = (TestBean) xbf.getBean("testBeanPrototype");
- tb.doSomething();
- }
- TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor");
- assertEquals(10, TestBeanImpl.constructionCount);
- assertEquals(10, interceptor.invocationCount);
+ assertConstructionAndInvocationCounts("testBeanPrototype", 10, 10);
}
@Test
public void testSingletonProxyWithPrototypeTarget() {
+ assertConstructionAndInvocationCounts("testBeanSingleton", 1, 10);
+ }
+
+ private void assertConstructionAndInvocationCounts(String beanName,
+ int constructionCount, int invocationCount) {
TestBeanImpl.constructionCount = 0;
- XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
+ BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml");
for (int i = 0; i < 10; i++) {
- TestBean tb = (TestBean) xbf.getBean("testBeanSingleton");
+ TestBean tb = (TestBean) bf.getBean(beanName);
tb.doSomething();
}
- TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor");
- assertEquals(1, TestBeanImpl.constructionCount);
- assertEquals(10, interceptor.invocationCount);
+ TestInterceptor interceptor = (TestInterceptor) bf.getBean("testInterceptor");
+ assertEquals(constructionCount, TestBeanImpl.constructionCount);
+ assertEquals(invocationCount, interceptor.invocationCount);
}
-
public static interface TestBean {
public void doSomething();
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java
index f7d325e4c53f..3a867c666640 100644
--- a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public void testIndexOfMethods() {
assertEquals(1, pf.indexOf(advisor));
assertEquals(-1, advised.indexOf(new DefaultPointcutAdvisor(null)));
}
-
+
@Test
public void testRemoveAdvisorByReference() {
TestBean target = new TestBean();
@@ -84,7 +84,7 @@ public void testRemoveAdvisorByReference() {
assertEquals(2, nop.getCount());
assertFalse(pf.removeAdvisor(new DefaultPointcutAdvisor(null)));
}
-
+
@Test
public void testRemoveAdvisorByIndex() {
TestBean target = new TestBean();
@@ -113,7 +113,7 @@ public void testRemoveAdvisorByIndex() {
assertEquals(1, cba.getCalls());
assertEquals(2, nop.getCount());
assertEquals(3, nop2.getCount());
-
+
// Check out of bounds
try {
pf.removeAdvisor(-1);
@@ -121,14 +121,14 @@ public void testRemoveAdvisorByIndex() {
catch (AopConfigException ex) {
// Ok
}
-
+
try {
pf.removeAdvisor(2);
}
catch (AopConfigException ex) {
// Ok
}
-
+
assertEquals(5, proxied.getAge());
assertEquals(4, nop2.getCount());
}
@@ -191,17 +191,17 @@ public int compareTo(Object arg0) {
assertEquals("Found correct number of interfaces", 3, factory.getProxiedInterfaces().length);
ITestBean tb = (ITestBean) factory.getProxy();
assertThat("Picked up secondary interface", tb, instanceOf(IOther.class));
-
+
raw.setAge(25);
assertTrue(tb.getAge() == raw.getAge());
long t = 555555L;
TimestampIntroductionInterceptor ti = new TimestampIntroductionInterceptor(t);
-
+
Class>[] oldProxiedInterfaces = factory.getProxiedInterfaces();
-
+
factory.addAdvisor(0, new DefaultIntroductionAdvisor(ti, TimeStamped.class));
-
+
Class>[] newProxiedInterfaces = factory.getProxiedInterfaces();
assertEquals("Advisor proxies one more interface after introduction", oldProxiedInterfaces.length + 1, newProxiedInterfaces.length);
@@ -210,7 +210,7 @@ public int compareTo(Object arg0) {
// Shouldn't fail;
((IOther) ts).absquatulate();
}
-
+
@Test
public void testInterceptorInclusionMethods() {
class MyInterceptor implements MethodInterceptor {
@@ -218,7 +218,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable {
throw new UnsupportedOperationException();
}
}
-
+
NopInterceptor di = new NopInterceptor();
NopInterceptor diUnused = new NopInterceptor();
ProxyFactory factory = new ProxyFactory(new TestBean());
@@ -228,7 +228,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable {
assertTrue(!factory.adviceIncluded(diUnused));
assertTrue(factory.countAdvicesOfType(NopInterceptor.class) == 1);
assertTrue(factory.countAdvicesOfType(MyInterceptor.class) == 0);
-
+
factory.addAdvice(0, diUnused);
assertTrue(factory.adviceIncluded(diUnused));
assertTrue(factory.countAdvicesOfType(NopInterceptor.class) == 2);
diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java
index ceae4f577e8c..127001b58ec7 100644
--- a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -150,7 +150,7 @@ public void afterThrowing(RemoteException ex) throws Throwable {
}
@SuppressWarnings("serial")
- private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
+ public static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
// Full method signature
public void afterThrowing(Method m, Object[] args, Object target, IOException ex) {
count("ioException");
diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java
index 9b3aaf6d9a34..487427aa6042 100644
--- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java
index 1fe27b3dfc58..639bd1a56cf4 100644
--- a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java
index 6ac026fcbf4a..d2f8b9b69507 100644
--- a/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ public final class DebugInterceptorTests {
@Test
public void testSunnyDayPathLogsCorrectly() throws Throwable {
Log log = createMock(Log.class);
-
+
MethodInvocation methodInvocation = createMock(MethodInvocation.class);
expect(log.isTraceEnabled()).andReturn(true);
@@ -56,7 +56,7 @@ public void testSunnyDayPathLogsCorrectly() throws Throwable {
@Test
public void testExceptionPathStillLogsCorrectly() throws Throwable {
Log log = createMock(Log.class);
-
+
MethodInvocation methodInvocation = createMock(MethodInvocation.class);
expect(log.isTraceEnabled()).andReturn(true);
diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java
index cc105bebcd61..2ceac0586185 100644
--- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,20 +30,20 @@
* @author Chris Beams
*/
public final class ExposeBeanNameAdvisorsTests {
-
+
private class RequiresBeanNameBoundTestBean extends TestBean {
private final String beanName;
-
+
public RequiresBeanNameBoundTestBean(String beanName) {
this.beanName = beanName;
}
-
+
public int getAge() {
assertEquals(beanName, ExposeBeanNameAdvisors.getBeanName());
return super.getAge();
}
}
-
+
@Test
public void testNoIntroduction() {
String beanName = "foo";
@@ -52,12 +52,12 @@ public void testNoIntroduction() {
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorWithoutIntroduction(beanName));
ITestBean proxy = (ITestBean) pf.getProxy();
-
+
assertFalse("No introduction", proxy instanceof NamedBean);
// Requires binding
proxy.getAge();
}
-
+
@Test
public void testWithIntroduction() {
String beanName = "foo";
@@ -66,11 +66,11 @@ public void testWithIntroduction() {
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorIntroducingNamedBean(beanName));
ITestBean proxy = (ITestBean) pf.getProxy();
-
+
assertTrue("Introduction was made", proxy instanceof NamedBean);
// Requires binding
proxy.getAge();
-
+
NamedBean nb = (NamedBean) proxy;
assertEquals("Name returned correctly", beanName, nb.getBeanName());
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java
index bfa9ea4d0535..e1f238667b65 100644
--- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,32 +17,28 @@
package org.springframework.aop.interceptor;
import static org.junit.Assert.*;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
+import org.springframework.beans.factory.BeanFactory;
import test.beans.ITestBean;
import test.beans.TestBean;
/**
* Non-XML tests are in AbstractAopProxyTests
- *
+ *
* @author Rod Johnson
* @author Chris Beams
*/
public final class ExposeInvocationInterceptorTests {
-
- private static final Resource CONTEXT =
- qualifiedResource(ExposeInvocationInterceptorTests.class, "context.xml");
@Test
public void testXmlConfig() {
- XmlBeanFactory bf = new XmlBeanFactory(CONTEXT);
+ BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml");
ITestBean tb = (ITestBean) bf.getBean("proxy");
- String name= "tony";
+ String name = "tony";
tb.setName(name);
// Fires context checks
assertEquals(name, tb.getName());
@@ -50,7 +46,6 @@ public void testXmlConfig() {
}
-
abstract class ExposedInvocationTestBean extends TestBean {
public String getName() {
@@ -64,15 +59,15 @@ public void absquatulate() {
assertions(invocation);
super.absquatulate();
}
-
+
protected abstract void assertions(MethodInvocation invocation);
}
-
class InvocationCheckExposedInvocationTestBean extends ExposedInvocationTestBean {
+
protected void assertions(MethodInvocation invocation) {
assertTrue(invocation.getThis() == this);
- assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(),
- ITestBean.class.isAssignableFrom(invocation.getMethod().getDeclaringClass()));
+ assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(),
+ ITestBean.class.isAssignableFrom(invocation.getMethod().getDeclaringClass()));
}
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java
index 5cc35f10ecbf..de7f7bce5416 100644
--- a/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java
index 7845f1268b67..20c165af9cb2 100644
--- a/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java
index 80f62da86b70..8dc810eb18d5 100644
--- a/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java
index 3706293c2c33..056967979156 100644
--- a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,26 +17,20 @@
package org.springframework.aop.scope;
import static org.junit.Assert.assertSame;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.junit.Test;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
+import org.springframework.beans.factory.BeanFactory;
/**
* @author Mark Fisher
* @author Chris Beams
*/
public final class ScopedProxyAutowireTests {
-
- private static final Class> CLASS = ScopedProxyAutowireTests.class;
-
- private static final Resource SCOPED_AUTOWIRE_TRUE_CONTEXT = qualifiedResource(CLASS, "scopedAutowireTrue.xml");
- private static final Resource SCOPED_AUTOWIRE_FALSE_CONTEXT = qualifiedResource(CLASS, "scopedAutowireFalse.xml");
@Test
public void testScopedProxyInheritsAutowireCandidateFalse() {
- XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_FALSE_CONTEXT);
+ BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "scopedAutowireFalse.xml");
TestBean autowired = (TestBean) bf.getBean("autowired");
TestBean unscoped = (TestBean) bf.getBean("unscoped");
assertSame(unscoped, autowired.getChild());
@@ -44,7 +38,7 @@ public void testScopedProxyInheritsAutowireCandidateFalse() {
@Test
public void testScopedProxyReplacesAutowireCandidateTrue() {
- XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_TRUE_CONTEXT);
+ BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "scopedAutowireTrue.xml");
TestBean autowired = (TestBean) bf.getBean("autowired");
TestBean scoped = (TestBean) bf.getBean("scoped");
assertSame(scoped, autowired.getChild());
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java
index b230ed726052..284809d236d2 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java
index c423579aa01f..b17b8ac6030e 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public boolean matches(Method method, Class> clazzy) {
return false;
}
}
-
+
Pointcut no = new TestPointcut();
assertFalse(AopUtils.canApply(no, Object.class));
}
@@ -64,7 +64,7 @@ public boolean matches(Method method, Class> clazz) {
}
Pointcut pc = new TestPointcut();
-
+
// will return true if we're not proxying interfaces
assertTrue(AopUtils.canApply(pc, Object.class));
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java
index 3c9f37ef1371..42992fb57c2a 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,11 +30,11 @@
* @author Chris Beams
*/
public final class ClassFiltersTests {
-
+
private ClassFilter exceptionFilter = new RootClassFilter(Exception.class);
-
+
private ClassFilter itbFilter = new RootClassFilter(ITestBean.class);
-
+
private ClassFilter hasRootCauseFilter = new RootClassFilter(NestedRuntimeException.class);
@Test
@@ -47,7 +47,7 @@ public void testUnion() {
assertTrue(union.matches(RuntimeException.class));
assertTrue(union.matches(TestBean.class));
}
-
+
@Test
public void testIntersection() {
assertTrue(exceptionFilter.matches(RuntimeException.class));
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java
index 1c250e966da3..ac320429ad07 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java
index 85b40b9112e5..eec75f28afd2 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,31 +33,31 @@
* @author Chris Beams
*/
public final class ComposablePointcutTests {
-
+
public static MethodMatcher GETTER_METHOD_MATCHER = new StaticMethodMatcher() {
public boolean matches(Method m, Class> targetClass) {
return m.getName().startsWith("get");
}
};
-
+
public static MethodMatcher GET_AGE_METHOD_MATCHER = new StaticMethodMatcher() {
public boolean matches(Method m, Class> targetClass) {
return m.getName().equals("getAge");
}
};
-
+
public static MethodMatcher ABSQUATULATE_METHOD_MATCHER = new StaticMethodMatcher() {
public boolean matches(Method m, Class> targetClass) {
return m.getName().equals("absquatulate");
}
};
-
+
public static MethodMatcher SETTER_METHOD_MATCHER = new StaticMethodMatcher() {
public boolean matches(Method m, Class> targetClass) {
return m.getName().startsWith("set");
}
};
-
+
@Test
public void testMatchAll() throws NoSuchMethodException {
Pointcut pc = new ComposablePointcut();
@@ -68,9 +68,9 @@ public void testMatchAll() throws NoSuchMethodException {
@Test
public void testFilterByClass() throws NoSuchMethodException {
ComposablePointcut pc = new ComposablePointcut();
-
+
assertTrue(pc.getClassFilter().matches(Object.class));
-
+
ClassFilter cf = new RootClassFilter(Exception.class);
pc.intersection(cf);
assertFalse(pc.getClassFilter().matches(Object.class));
@@ -92,15 +92,15 @@ public void testUnionMethodMatcher() {
assertFalse(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class, null));
assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_AGE, TestBean.class, null));
assertFalse(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_NAME, TestBean.class, null));
-
+
pc.union(GETTER_METHOD_MATCHER);
// Should now match all getter methods
assertFalse(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class, null));
assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_AGE, TestBean.class, null));
assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_NAME, TestBean.class, null));
-
+
pc.union(ABSQUATULATE_METHOD_MATCHER);
- // Should now match absquatulate() as well
+ // Should now match absquatulate() as well
assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class, null));
assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_AGE, TestBean.class, null));
assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_NAME, TestBean.class, null));
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java
index ed17db66188b..6288f7674af4 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@
* @author Chris Beams
*/
public final class ControlFlowPointcutTests {
-
+
@Test
public void testMatches() {
TestBean target = new TestBean();
@@ -41,21 +41,21 @@ public void testMatches() {
ProxyFactory pf = new ProxyFactory(target);
ITestBean proxied = (ITestBean) pf.getProxy();
pf.addAdvisor(new DefaultPointcutAdvisor(cflow, nop));
-
+
// Not advised, not under One
assertEquals(target.getAge(), proxied.getAge());
assertEquals(0, nop.getCount());
-
+
// Will be advised
assertEquals(target.getAge(), new One().getAge(proxied));
assertEquals(1, nop.getCount());
-
+
// Won't be advised
assertEquals(target.getAge(), new One().nomatch(proxied));
assertEquals(1, nop.getCount());
assertEquals(3, cflow.getEvaluations());
}
-
+
/**
* Check that we can use a cflow pointcut only in conjunction with
* a static pointcut: e.g. all setter methods that are invoked under
@@ -73,19 +73,19 @@ public void testSelectiveApplication() {
ProxyFactory pf = new ProxyFactory(target);
ITestBean proxied = (ITestBean) pf.getProxy();
pf.addAdvisor(new DefaultPointcutAdvisor(settersUnderOne, nop));
-
+
// Not advised, not under One
target.setAge(16);
assertEquals(0, nop.getCount());
-
+
// Not advised; under One but not a setter
assertEquals(16, new One().getAge(proxied));
assertEquals(0, nop.getCount());
-
+
// Won't be advised
new One().set(proxied);
assertEquals(1, nop.getCount());
-
+
// We saved most evaluations
assertEquals(1, cflow.getEvaluations());
}
@@ -99,7 +99,7 @@ public void testEqualsAndHashCode() throws Exception {
assertEquals(new ControlFlowPointcut(One.class, "getAge").hashCode(), new ControlFlowPointcut(One.class, "getAge").hashCode());
assertFalse(new ControlFlowPointcut(One.class, "getAge").hashCode() == new ControlFlowPointcut(One.class).hashCode());
}
-
+
public class One {
int getAge(ITestBean proxied) {
return proxied.getAge();
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java
index cd51a4895c4b..e3cf9801b2ad 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -79,7 +79,7 @@ public void testIntroductionInterceptorWithInterfaceHierarchy() throws Exception
long timestamp = 111L;
expect(ts.getTimeStamp()).andReturn(timestamp);
replay(ts);
-
+
factory.addAdvisor(0, new DefaultIntroductionAdvisor(new DelegatingIntroductionInterceptor(ts), SubTimeStamped.class));
SubTimeStamped tsp = (SubTimeStamped) factory.getProxy();
@@ -160,7 +160,6 @@ public long getTimeStamp() {
//assertTrue(Arrays.binarySearch(pf.getProxiedInterfaces(), TimeStamped.class) != -1);
TimeStamped ts = (TimeStamped) pf.getProxy();
- assertTrue(ts instanceof TimeStamped);
// Shoulnd't proxy framework interfaces
assertTrue(!(ts instanceof MethodInterceptor));
assertTrue(!(ts instanceof IntroductionInterceptor));
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java
index 4df8bcde48ef..d752d0ca5996 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,9 +37,9 @@ public final class MethodMatchersTests {
private final Method EXCEPTION_GETMESSAGE;
private final Method ITESTBEAN_SETAGE;
-
+
private final Method ITESTBEAN_GETAGE;
-
+
private final Method IOTHER_ABSQUATULATE;
public MethodMatchersTests() throws Exception {
@@ -55,7 +55,7 @@ public void testDefaultMatchesAll() throws Exception {
assertTrue(defaultMm.matches(EXCEPTION_GETMESSAGE, Exception.class));
assertTrue(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class));
}
-
+
@Test
public void testMethodMatcherTrueSerializable() throws Exception {
assertSame(SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE), MethodMatcher.TRUE);
@@ -72,7 +72,7 @@ public void testSingle() throws Exception {
assertFalse(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class));
}
-
+
@Test
public void testDynamicAndStaticMethodMatcherIntersection() throws Exception {
MethodMatcher mm1 = MethodMatcher.TRUE;
@@ -87,13 +87,13 @@ public void testDynamicAndStaticMethodMatcherIntersection() throws Exception {
assertTrue("2Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class));
assertFalse("3 - not Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class, new Object[] { new Integer(5) }));
}
-
+
@Test
public void testStaticMethodMatcherUnion() throws Exception {
MethodMatcher getterMatcher = new StartsWithMatcher("get");
MethodMatcher setterMatcher = new StartsWithMatcher("set");
MethodMatcher union = MethodMatchers.union(getterMatcher, setterMatcher);
-
+
assertFalse("Union is a static matcher", union.isRuntime());
assertTrue("Matched setAge method", union.matches(ITESTBEAN_SETAGE, TestBean.class));
assertTrue("Matched getAge method", union.matches(ITESTBEAN_GETAGE, TestBean.class));
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java
index 996d72f02fa5..8b89281e763c 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,11 +34,11 @@
* @author Chris Beams
*/
public final class NameMatchMethodPointcutTests {
-
+
protected NameMatchMethodPointcut pc;
-
+
protected Person proxied;
-
+
protected SerializableNopInterceptor nop;
/**
@@ -52,7 +52,7 @@ public void setUp() {
pf.addAdvisor(new DefaultPointcutAdvisor(pc, nop));
proxied = (Person) pf.getProxy();
}
-
+
@Test
public void testMatchingOnly() {
// Can't do exact matching through isMatch
@@ -63,7 +63,7 @@ public void testMatchingOnly() {
assertFalse(pc.isMatch("setName", "set"));
assertTrue(pc.isMatch("testing", "*ing"));
}
-
+
@Test
public void testEmpty() throws Throwable {
assertEquals(0, nop.getCount());
@@ -72,8 +72,8 @@ public void testEmpty() throws Throwable {
proxied.echo(null);
assertEquals(0, nop.getCount());
}
-
-
+
+
@Test
public void testMatchOneMethod() throws Throwable {
pc.addMethodName("echo");
@@ -84,7 +84,7 @@ public void testMatchOneMethod() throws Throwable {
assertEquals(0, nop.getCount());
proxied.echo(null);
assertEquals(1, nop.getCount());
-
+
proxied.setName("");
assertEquals(2, nop.getCount());
proxied.setAge(25);
@@ -102,7 +102,7 @@ public void testSets() throws Throwable {
proxied.echo(null);
assertEquals(2, nop.getCount());
}
-
+
@Test
public void testSerializable() throws Throwable {
testSets();
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java
index eb008c7f30e1..3c3bf029ee9f 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,12 +31,12 @@
* @author Chris Beams
*/
public final class PointcutsTests {
-
+
public static Method TEST_BEAN_SET_AGE;
public static Method TEST_BEAN_GET_AGE;
public static Method TEST_BEAN_GET_NAME;
public static Method TEST_BEAN_ABSQUATULATE;
-
+
static {
try {
TEST_BEAN_SET_AGE = TestBean.class.getMethod("setAge", new Class[] { int.class });
@@ -48,7 +48,7 @@ public final class PointcutsTests {
throw new RuntimeException("Shouldn't happen: error in test suite");
}
}
-
+
/**
* Matches only TestBean class, not subclasses
*/
@@ -65,13 +65,13 @@ public boolean matches(Method m, Class> targetClass) {
return true;
}
};
-
+
public static Pointcut allClassSetterPointcut = Pointcuts.SETTERS;
-
+
// Subclass used for matching
public static class MyTestBean extends TestBean {
}
-
+
public static Pointcut myTestBeanSetterPointcut = new StaticMethodMatcherPointcut() {
public ClassFilter getClassFilter() {
return new RootClassFilter(MyTestBean.class);
@@ -81,7 +81,7 @@ public boolean matches(Method m, Class> targetClass) {
return m.getName().startsWith("set");
}
};
-
+
// Will match MyTestBeanSubclass
public static Pointcut myTestBeanGetterPointcut = new StaticMethodMatcherPointcut() {
public ClassFilter getClassFilter() {
@@ -92,11 +92,11 @@ public boolean matches(Method m, Class> targetClass) {
return m.getName().startsWith("get");
}
};
-
+
// Still more specific class
public static class MyTestBeanSubclass extends MyTestBean {
}
-
+
public static Pointcut myTestBeanSubclassGetterPointcut = new StaticMethodMatcherPointcut() {
public ClassFilter getClassFilter() {
return new RootClassFilter(MyTestBeanSubclass.class);
@@ -106,14 +106,14 @@ public boolean matches(Method m, Class> targetClass) {
return m.getName().startsWith("get");
}
};
-
+
public static Pointcut allClassGetterPointcut = Pointcuts.GETTERS;
-
+
public static Pointcut allClassGetAgePointcut = new NameMatchMethodPointcut().addMethodName("getAge");
-
+
public static Pointcut allClassGetNamePointcut = new NameMatchMethodPointcut().addMethodName("getName");
-
-
+
+
@Test
public void testTrue() {
assertTrue(Pointcuts.matches(Pointcut.TRUE, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)}));
@@ -133,7 +133,7 @@ public void testMatches() {
assertTrue(Pointcuts.matches(allClassGetterPointcut, TEST_BEAN_GET_AGE, TestBean.class, null));
assertFalse(Pointcuts.matches(allClassGetterPointcut, TEST_BEAN_ABSQUATULATE, TestBean.class, null));
}
-
+
/**
* Should match all setters and getters on any class
*/
@@ -144,7 +144,7 @@ public void testUnionOfSettersAndGetters() {
assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, TestBean.class, null));
assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null));
}
-
+
@Test
public void testUnionOfSpecificGetters() {
Pointcut union = Pointcuts.union(allClassGetAgePointcut, allClassGetNamePointcut);
@@ -153,7 +153,7 @@ public void testUnionOfSpecificGetters() {
assertFalse(Pointcuts.matches(allClassGetAgePointcut, TEST_BEAN_GET_NAME, TestBean.class, null));
assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_NAME, TestBean.class, null));
assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null));
-
+
// Union with all setters
union = Pointcuts.union(union, allClassSetterPointcut);
assertTrue(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)}));
@@ -161,10 +161,10 @@ public void testUnionOfSpecificGetters() {
assertFalse(Pointcuts.matches(allClassGetAgePointcut, TEST_BEAN_GET_NAME, TestBean.class, null));
assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_NAME, TestBean.class, null));
assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null));
-
+
assertTrue(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)}));
}
-
+
/**
* Tests vertical composition. First pointcut matches all setters.
* Second one matches all getters in the MyTestBean class. TestBean getters shouldn't pass.
@@ -174,7 +174,7 @@ public void testUnionOfAllSettersAndSubclassSetters() {
assertFalse(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)}));
assertTrue(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_SET_AGE, MyTestBean.class, new Object[] { new Integer(6)}));
assertFalse(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_GET_AGE, TestBean.class, null));
-
+
Pointcut union = Pointcuts.union(myTestBeanSetterPointcut, allClassGetterPointcut);
assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, TestBean.class, null));
assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, MyTestBean.class, null));
@@ -182,7 +182,7 @@ public void testUnionOfAllSettersAndSubclassSetters() {
assertTrue(Pointcuts.matches(union, TEST_BEAN_SET_AGE, MyTestBean.class, new Object[] { new Integer(6)}));
assertFalse(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)}));
}
-
+
/**
* Intersection should be MyTestBean getAge() only:
* it's the union of allClassGetAge and subclass getters
@@ -195,7 +195,7 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() {
assertFalse(Pointcuts.matches(myTestBeanGetterPointcut, TEST_BEAN_GET_AGE, TestBean.class, null));
assertTrue(Pointcuts.matches(myTestBeanGetterPointcut, TEST_BEAN_GET_NAME, MyTestBean.class, null));
assertTrue(Pointcuts.matches(myTestBeanGetterPointcut, TEST_BEAN_GET_AGE, MyTestBean.class, null));
-
+
Pointcut intersection = Pointcuts.intersection(allClassGetAgePointcut, myTestBeanGetterPointcut);
assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, TestBean.class, null));
assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_AGE, TestBean.class, null));
@@ -204,7 +204,7 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() {
// Matches subclass of MyTestBean
assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, MyTestBeanSubclass.class, null));
assertTrue(Pointcuts.matches(intersection, TEST_BEAN_GET_AGE, MyTestBeanSubclass.class, null));
-
+
// Now intersection with MyTestBeanSubclass getters should eliminate MyTestBean target
intersection = Pointcuts.intersection(intersection, myTestBeanSubclassGetterPointcut);
assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, TestBean.class, null));
@@ -214,7 +214,7 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() {
// Still matches subclass of MyTestBean
assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, MyTestBeanSubclass.class, null));
assertTrue(Pointcuts.matches(intersection, TEST_BEAN_GET_AGE, MyTestBeanSubclass.class, null));
-
+
// Now union with all TestBean methods
Pointcut union = Pointcuts.union(intersection, allTestBeanMethodsPointcut);
assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_NAME, TestBean.class, null));
@@ -224,12 +224,12 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() {
// Still matches subclass of MyTestBean
assertFalse(Pointcuts.matches(union, TEST_BEAN_GET_NAME, MyTestBeanSubclass.class, null));
assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, MyTestBeanSubclass.class, null));
-
+
assertTrue(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null));
assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, MyTestBean.class, null));
}
-
-
+
+
/**
* The intersection of these two pointcuts leaves nothing.
*/
diff --git a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java
index 8218e4d5db3c..2a71e548f6f6 100644
--- a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,13 +17,11 @@
package org.springframework.aop.support;
import static org.junit.Assert.assertEquals;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
import test.aop.NopInterceptor;
import test.aop.SerializableNopInterceptor;
@@ -37,18 +35,15 @@
* @author Chris Beams
*/
public final class RegexpMethodPointcutAdvisorIntegrationTests {
-
- private static final Resource CONTEXT =
- qualifiedResource(RegexpMethodPointcutAdvisorIntegrationTests.class, "context.xml");
@Test
public void testSinglePattern() throws Throwable {
- BeanFactory bf = new XmlBeanFactory(CONTEXT);
+ BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml");
ITestBean advised = (ITestBean) bf.getBean("settersAdvised");
// Interceptor behind regexp advisor
NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor");
assertEquals(0, nop.getCount());
-
+
int newAge = 12;
// Not advised
advised.exceptional(null);
@@ -58,21 +53,21 @@ public void testSinglePattern() throws Throwable {
// Only setter fired
assertEquals(1, nop.getCount());
}
-
+
@Test
public void testMultiplePatterns() throws Throwable {
- BeanFactory bf = new XmlBeanFactory(CONTEXT);
+ BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml");
// This is a CGLIB proxy, so we can proxy it to the target class
TestBean advised = (TestBean) bf.getBean("settersAndAbsquatulateAdvised");
// Interceptor behind regexp advisor
NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor");
assertEquals(0, nop.getCount());
-
+
int newAge = 12;
// Not advised
advised.exceptional(null);
assertEquals(0, nop.getCount());
-
+
// This is proxied
advised.absquatulate();
assertEquals(1, nop.getCount());
@@ -81,21 +76,21 @@ public void testMultiplePatterns() throws Throwable {
// Only setter fired
assertEquals(2, nop.getCount());
}
-
+
@Test
public void testSerialization() throws Throwable {
- BeanFactory bf = new XmlBeanFactory(CONTEXT);
+ BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml");
// This is a CGLIB proxy, so we can proxy it to the target class
Person p = (Person) bf.getBean("serializableSettersAdvised");
// Interceptor behind regexp advisor
NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor");
assertEquals(0, nop.getCount());
-
+
int newAge = 12;
// Not advised
assertEquals(0, p.getAge());
assertEquals(0, nop.getCount());
-
+
// This is proxied
p.setAge(newAge);
assertEquals(1, nop.getCount());
@@ -103,7 +98,7 @@ public void testSerialization() throws Throwable {
assertEquals(newAge, p.getAge());
// Only setter fired
assertEquals(2, nop.getCount());
-
+
// Serialize and continue...
p = (Person) SerializationTestUtils.serializeAndDeserialize(p);
assertEquals(newAge, p.getAge());
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java
index 69907b0f2f1c..269d585e9d42 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java
@@ -33,7 +33,7 @@
* @since 2.0
*/
public final class CommonsPoolTargetSourceProxyTests {
-
+
private static final Resource CONTEXT =
qualifiedResource(CommonsPoolTargetSourceProxyTests.class, "context.xml");
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java
index 284c3ae56191..ef872560f880 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,7 @@
package org.springframework.aop.target;
import static org.junit.Assert.*;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.junit.After;
import org.junit.Before;
@@ -25,8 +25,7 @@
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.DefaultPointcutAdvisor;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import test.aop.SerializableNopInterceptor;
import test.beans.Person;
@@ -40,19 +39,17 @@
* @author Chris Beams
*/
public final class HotSwappableTargetSourceTests {
-
- private static final Resource CONTEXT = qualifiedResource(HotSwappableTargetSourceTests.class, "context.xml");
/** Initial count value set in bean factory XML */
private static final int INITIAL_COUNT = 10;
- private XmlBeanFactory beanFactory;
-
+ private ConfigurableBeanFactory beanFactory;
+
@Before
public void setUp() throws Exception {
- this.beanFactory = new XmlBeanFactory(CONTEXT);
+ this.beanFactory = beanFactoryFromQualifiedResource(getClass(), "context.xml");
}
-
+
/**
* We must simulate container shutdown, which should clear threads.
*/
@@ -72,42 +69,42 @@ public void testBasicFunctionality() {
assertEquals(INITIAL_COUNT, proxied.getCount() );
proxied.doWork();
assertEquals(INITIAL_COUNT + 1, proxied.getCount() );
-
+
proxied = (SideEffectBean) beanFactory.getBean("swappable");
proxied.doWork();
assertEquals(INITIAL_COUNT + 2, proxied.getCount() );
}
-
+
@Test
public void testValidSwaps() {
SideEffectBean target1 = (SideEffectBean) beanFactory.getBean("target1");
SideEffectBean target2 = (SideEffectBean) beanFactory.getBean("target2");
-
+
SideEffectBean proxied = (SideEffectBean) beanFactory.getBean("swappable");
assertEquals(target1.getCount(), proxied.getCount() );
proxied.doWork();
assertEquals(INITIAL_COUNT + 1, proxied.getCount() );
-
+
HotSwappableTargetSource swapper = (HotSwappableTargetSource) beanFactory.getBean("swapper");
Object old = swapper.swap(target2);
assertEquals("Correct old target was returned", target1, old);
-
+
// TODO should be able to make this assertion: need to fix target handling
// in AdvisedSupport
//assertEquals(target2, ((Advised) proxied).getTarget());
-
+
assertEquals(20, proxied.getCount());
proxied.doWork();
assertEquals(21, target2.getCount());
-
+
// Swap it back
swapper.swap(target1);
assertEquals(target1.getCount(), proxied.getCount());
}
-
-
+
+
/**
- *
+ *
* @param invalid
* @return the message
*/
@@ -122,46 +119,46 @@ private IllegalArgumentException testRejectsSwapToInvalidValue(Object invalid) {
// Ok
aopex = ex;
}
-
+
// It shouldn't be corrupted, it should still work
testBasicFunctionality();
return aopex;
}
-
+
@Test
public void testRejectsSwapToNull() {
IllegalArgumentException ex = testRejectsSwapToInvalidValue(null);
assertTrue(ex.getMessage().indexOf("null") != -1);
}
-
+
// TODO test reject swap to wrong interface or class?
// how to decide what's valid?
-
-
+
+
@Test
public void testSerialization() throws Exception {
SerializablePerson sp1 = new SerializablePerson();
sp1.setName("Tony");
SerializablePerson sp2 = new SerializablePerson();
sp1.setName("Gordon");
-
+
HotSwappableTargetSource hts = new HotSwappableTargetSource(sp1);
ProxyFactory pf = new ProxyFactory();
pf.addInterface(Person.class);
pf.setTargetSource(hts);
pf.addAdvisor(new DefaultPointcutAdvisor(new SerializableNopInterceptor()));
Person p = (Person) pf.getProxy();
-
+
assertEquals(sp1.getName(), p.getName());
hts.swap(sp2);
assertEquals(sp2.getName(), p.getName());
-
+
p = (Person) SerializationTestUtils.serializeAndDeserialize(p);
// We need to get a reference to the client-side targetsource
hts = (HotSwappableTargetSource) ((Advised) p).getTargetSource();
assertEquals(sp2.getName(), p.getName());
hts.swap(sp1);
assertEquals(sp1.getName(), p.getName());
-
+
}
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java
index d6dc8f426cd6..03b92d94d12d 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java
index b26fbb1e9118..c0ac218ae20e 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,13 +17,12 @@
package org.springframework.aop.target;
import static org.junit.Assert.*;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import java.util.Set;
import org.junit.Test;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import test.beans.ITestBean;
@@ -34,16 +33,10 @@
* @since 07.01.2005
*/
public final class LazyInitTargetSourceTests {
-
- private static final Class> CLASS = LazyInitTargetSourceTests.class;
-
- private static final Resource SINGLETON_CONTEXT = qualifiedResource(CLASS, "singleton.xml");
- private static final Resource CUSTOM_TARGET_CONTEXT = qualifiedResource(CLASS, "customTarget.xml");
- private static final Resource FACTORY_BEAN_CONTEXT = qualifiedResource(CLASS, "factoryBean.xml");
@Test
public void testLazyInitSingletonTargetSource() {
- XmlBeanFactory bf = new XmlBeanFactory(SINGLETON_CONTEXT);
+ DefaultListableBeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "singleton.xml");
bf.preInstantiateSingletons();
ITestBean tb = (ITestBean) bf.getBean("proxy");
@@ -54,7 +47,8 @@ public void testLazyInitSingletonTargetSource() {
@Test
public void testCustomLazyInitSingletonTargetSource() {
- XmlBeanFactory bf = new XmlBeanFactory(CUSTOM_TARGET_CONTEXT);
+ DefaultListableBeanFactory bf = beanFactoryFromQualifiedResource(getClass(),
+ "customTarget.xml");
bf.preInstantiateSingletons();
ITestBean tb = (ITestBean) bf.getBean("proxy");
@@ -65,7 +59,8 @@ public void testCustomLazyInitSingletonTargetSource() {
@Test
public void testLazyInitFactoryBeanTargetSource() {
- XmlBeanFactory bf = new XmlBeanFactory(FACTORY_BEAN_CONTEXT);
+ DefaultListableBeanFactory bf = beanFactoryFromQualifiedResource(getClass(),
+ "factoryBean.xml");
bf.preInstantiateSingletons();
Set> set1 = (Set>) bf.getBean("proxy1");
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java
index 43ba8a211a7e..143601c44290 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,10 +41,12 @@ public final class PrototypeBasedTargetSourceTests {
public void testSerializability() throws Exception {
MutablePropertyValues tsPvs = new MutablePropertyValues();
tsPvs.add("targetBeanName", "person");
- RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class, tsPvs);
+ RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class);
+ tsBd.setPropertyValues(tsPvs);
MutablePropertyValues pvs = new MutablePropertyValues();
- RootBeanDefinition bd = new RootBeanDefinition(SerializablePerson.class, pvs);
+ RootBeanDefinition bd = new RootBeanDefinition(SerializablePerson.class);
+ bd.setPropertyValues(pvs);
bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
@@ -59,13 +61,14 @@ public void testSerializability() throws Exception {
assertNotNull(sts.getTarget());
}
-
+
private static class TestTargetSource extends AbstractPrototypeBasedTargetSource {
-
+
/**
* Nonserializable test field to check that subclass
* state can't prevent serialization from working
*/
+ @SuppressWarnings("unused")
private TestBean thisFieldIsNotSerializable = new TestBean();
public Object getTarget() throws Exception {
@@ -77,4 +80,4 @@ public void releaseTarget(Object target) throws Exception {
}
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java
index c5f0fa9d3859..cb4f80d38fea 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,13 +17,11 @@
package org.springframework.aop.target;
import static org.junit.Assert.assertEquals;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
import test.beans.SideEffectBean;
@@ -33,17 +31,15 @@
* @author Chris Beams
*/
public final class PrototypeTargetSourceTests {
-
- private static final Resource CONTEXT = qualifiedResource(PrototypeTargetSourceTests.class, "context.xml");
-
+
/** Initial count value set in bean factory XML */
private static final int INITIAL_COUNT = 10;
-
+
private BeanFactory beanFactory;
-
+
@Before
public void setUp() throws Exception {
- this.beanFactory = new XmlBeanFactory(CONTEXT);
+ this.beanFactory = beanFactoryFromQualifiedResource(getClass(), "context.xml");
}
/**
@@ -57,7 +53,7 @@ public void testPrototypeAndSingletonBehaveDifferently() {
assertEquals(INITIAL_COUNT, singleton.getCount() );
singleton.doWork();
assertEquals(INITIAL_COUNT + 1, singleton.getCount() );
-
+
SideEffectBean prototype = (SideEffectBean) beanFactory.getBean("prototype");
assertEquals(INITIAL_COUNT, prototype.getCount() );
prototype.doWork();
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java
index bd79620b700b..4693df4128e5 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2005 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,12 +17,11 @@
package org.springframework.aop.target;
import static org.junit.Assert.*;
-import static test.util.TestResourceUtils.qualifiedResource;
+import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource;
import org.junit.Before;
import org.junit.Test;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.core.io.Resource;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import test.beans.ITestBean;
import test.beans.SideEffectBean;
@@ -33,26 +32,24 @@
* @author Chris Beams
*/
public class ThreadLocalTargetSourceTests {
-
- private static final Resource CONTEXT = qualifiedResource(ThreadLocalTargetSourceTests.class, "context.xml");
/** Initial count value set in bean factory XML */
private static final int INITIAL_COUNT = 10;
- private XmlBeanFactory beanFactory;
-
+ private DefaultListableBeanFactory beanFactory;
+
@Before
public void setUp() throws Exception {
- this.beanFactory = new XmlBeanFactory(CONTEXT);
+ this.beanFactory = beanFactoryFromQualifiedResource(getClass(), "context.xml");
}
-
+
/**
* We must simulate container shutdown, which should clear threads.
*/
protected void tearDown() {
this.beanFactory.destroySingletons();
}
-
+
/**
* Check we can use two different ThreadLocalTargetSources
* managing objects of different types without them interfering
@@ -64,7 +61,7 @@ public void testUseDifferentManagedInstancesInSameThread() {
assertEquals(INITIAL_COUNT, apartment.getCount() );
apartment.doWork();
assertEquals(INITIAL_COUNT + 1, apartment.getCount() );
-
+
ITestBean test = (ITestBean) beanFactory.getBean("threadLocal2");
assertEquals("Rod", test.getName());
assertEquals("Kerry", test.getSpouse().getName());
@@ -76,11 +73,11 @@ public void testReuseInSameThread() {
assertEquals(INITIAL_COUNT, apartment.getCount() );
apartment.doWork();
assertEquals(INITIAL_COUNT + 1, apartment.getCount() );
-
+
apartment = (SideEffectBean) beanFactory.getBean("apartment");
assertEquals(INITIAL_COUNT + 1, apartment.getCount() );
}
-
+
/**
* Relies on introduction.
*/
@@ -101,7 +98,7 @@ public void testCanGetStatsViaMixin() {
// Only one thread so only one object can have been bound
assertEquals(1, stats.getObjectCount());
}
-
+
@Test
public void testNewThreadHasOwnInstance() throws InterruptedException {
SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment");
@@ -110,7 +107,7 @@ public void testNewThreadHasOwnInstance() throws InterruptedException {
apartment.doWork();
apartment.doWork();
assertEquals(INITIAL_COUNT + 3, apartment.getCount() );
-
+
class Runner implements Runnable {
public SideEffectBean mine;
public void run() {
@@ -124,16 +121,16 @@ public void run() {
Thread t = new Thread(r);
t.start();
t.join();
-
+
assertNotNull(r);
-
+
// Check it didn't affect the other thread's copy
assertEquals(INITIAL_COUNT + 3, apartment.getCount() );
-
- // When we use other thread's copy in this thread
+
+ // When we use other thread's copy in this thread
// it should behave like ours
assertEquals(INITIAL_COUNT + 3, r.mine.getCount() );
-
+
// Bound to two threads
assertEquals(2, ((ThreadLocalTargetSourceStats) apartment).getObjectCount());
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java
index ee0913a11460..f66421e2fd72 100644
--- a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java b/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java
index 60c43c858ff6..140f0fee3d4d 100644
--- a/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java
+++ b/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java
@@ -25,4 +25,4 @@
@Target(ElementType.TYPE)
public @interface EmptySpringAnnotation {
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/aop/DefaultLockable.java b/spring-aop/src/test/java/test/aop/DefaultLockable.java
index 42d6c73cb096..82c59d8bc543 100644
--- a/spring-aop/src/test/java/test/aop/DefaultLockable.java
+++ b/spring-aop/src/test/java/test/aop/DefaultLockable.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2008 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
/**
* Simple implementation of Lockable interface for use in mixins.
- *
+ *
* @author Rod Johnson
*/
public class DefaultLockable implements Lockable {
diff --git a/spring-aop/src/test/java/test/aop/Lockable.java b/spring-aop/src/test/java/test/aop/Lockable.java
index 94272745673b..cc1a869d9835 100644
--- a/spring-aop/src/test/java/test/aop/Lockable.java
+++ b/spring-aop/src/test/java/test/aop/Lockable.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2008 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,15 +19,15 @@
/**
* Simple interface to use for mixins
- *
+ *
* @author Rod Johnson
*
*/
public interface Lockable {
-
+
void lock();
-
+
void unlock();
-
+
boolean locked();
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/aop/MethodCounter.java b/spring-aop/src/test/java/test/aop/MethodCounter.java
index 9c5ed06e9ac7..745b7289cbbc 100644
--- a/spring-aop/src/test/java/test/aop/MethodCounter.java
+++ b/spring-aop/src/test/java/test/aop/MethodCounter.java
@@ -22,7 +22,7 @@
/**
* Abstract superclass for counting advices etc.
- *
+ *
* @author Rod Johnson
* @author Chris Beams
*/
diff --git a/spring-aop/src/test/java/test/aop/NopInterceptor.java b/spring-aop/src/test/java/test/aop/NopInterceptor.java
index 81bdd9e703fb..1dc341d427b5 100644
--- a/spring-aop/src/test/java/test/aop/NopInterceptor.java
+++ b/spring-aop/src/test/java/test/aop/NopInterceptor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2008 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
* @author Rod Johnson
*/
public class NopInterceptor implements MethodInterceptor {
-
+
private int count;
/**
@@ -35,11 +35,11 @@ public Object invoke(MethodInvocation invocation) throws Throwable {
increment();
return invocation.proceed();
}
-
+
public int getCount() {
return this.count;
}
-
+
protected void increment() {
++count;
}
diff --git a/spring-aop/src/test/java/test/aop/PerTargetAspect.java b/spring-aop/src/test/java/test/aop/PerTargetAspect.java
index 2d373f17e7a7..eef3c3cdea16 100644
--- a/spring-aop/src/test/java/test/aop/PerTargetAspect.java
+++ b/spring-aop/src/test/java/test/aop/PerTargetAspect.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package test.aop;
@@ -32,4 +32,4 @@ public int getOrder() {
public void setOrder(int order) {
this.order = order;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java b/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java
index ca425b81f6c1..be041c6302fb 100644
--- a/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java
+++ b/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2008 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,26 +23,26 @@
/**
* Subclass of NopInterceptor that is serializable and
* can be used to test proxy serialization.
- *
+ *
* @author Rod Johnson
* @author Chris Beams
*/
@SuppressWarnings("serial")
public class SerializableNopInterceptor extends NopInterceptor implements Serializable {
-
+
/**
* We must override this field and the related methods as
* otherwise count won't be serialized from the non-serializable
* NopInterceptor superclass.
*/
private int count;
-
+
public int getCount() {
return this.count;
}
-
+
protected void increment() {
++count;
}
-
-}
\ No newline at end of file
+
+}
diff --git a/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java b/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java
index 42ee4bf0ca3b..6745457a9d23 100644
--- a/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java
+++ b/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java
@@ -34,4 +34,4 @@ public int returnCallCount(ProceedingJoinPoint pjp) throws Exception {
public void countSet(int newAge) throws Exception {
++totalCalls;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/Colour.java b/spring-aop/src/test/java/test/beans/Colour.java
index 8793fd3f94ba..f91897055594 100644
--- a/spring-aop/src/test/java/test/beans/Colour.java
+++ b/spring-aop/src/test/java/test/beans/Colour.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
/**
* @author Rob Harrop
*/
-@SuppressWarnings("serial")
+@SuppressWarnings({ "serial", "deprecation" })
public class Colour extends ShortCodedLabeledEnum {
public static final Colour RED = new Colour(0, "RED");
@@ -33,4 +33,4 @@ private Colour(int code, String label) {
super(code, label);
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/INestedTestBean.java b/spring-aop/src/test/java/test/beans/INestedTestBean.java
index 228109c284ab..1023dbbc1399 100644
--- a/spring-aop/src/test/java/test/beans/INestedTestBean.java
+++ b/spring-aop/src/test/java/test/beans/INestedTestBean.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,4 +20,4 @@ public interface INestedTestBean {
public String getCompany();
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/IOther.java b/spring-aop/src/test/java/test/beans/IOther.java
index 734235aa068a..80fe4e84983b 100644
--- a/spring-aop/src/test/java/test/beans/IOther.java
+++ b/spring-aop/src/test/java/test/beans/IOther.java
@@ -1,13 +1,13 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,4 +21,4 @@ public interface IOther {
void absquatulate();
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/ITestBean.java b/spring-aop/src/test/java/test/beans/ITestBean.java
index 74f371b05476..09c20ec73b4a 100644
--- a/spring-aop/src/test/java/test/beans/ITestBean.java
+++ b/spring-aop/src/test/java/test/beans/ITestBean.java
@@ -66,4 +66,4 @@ public interface ITestBean {
void unreliableFileOperation() throws IOException;
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/NestedTestBean.java b/spring-aop/src/test/java/test/beans/NestedTestBean.java
index d3fde438b67b..b0f9df9d9b6e 100644
--- a/spring-aop/src/test/java/test/beans/NestedTestBean.java
+++ b/spring-aop/src/test/java/test/beans/NestedTestBean.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,4 +57,4 @@ public String toString() {
return "NestedTestBean: " + this.company;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/Person.java b/spring-aop/src/test/java/test/beans/Person.java
index d163756b4e27..163f110d960e 100644
--- a/spring-aop/src/test/java/test/beans/Person.java
+++ b/spring-aop/src/test/java/test/beans/Person.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,20 +17,20 @@
package test.beans;
/**
- *
+ *
* @author Rod Johnson
*/
public interface Person {
-
+
String getName();
void setName(String name);
int getAge();
void setAge(int i);
-
- /**
+
+ /**
* Test for non-property method matching.
- * If the parameter is a Throwable, it will be thrown rather than
+ * If the parameter is a Throwable, it will be thrown rather than
* returned.
*/
Object echo(Object o) throws Throwable;
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/SerializablePerson.java b/spring-aop/src/test/java/test/beans/SerializablePerson.java
index e0a1839c0c11..adb2966907e2 100644
--- a/spring-aop/src/test/java/test/beans/SerializablePerson.java
+++ b/spring-aop/src/test/java/test/beans/SerializablePerson.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,26 +34,26 @@ public class SerializablePerson implements Person, Serializable {
public int getAge() {
return age;
}
-
+
public void setAge(int age) {
this.age = age;
}
-
+
public String getName() {
return name;
}
-
+
public void setName(String name) {
this.name = name;
}
-
+
public Object echo(Object o) throws Throwable {
if (o instanceof Throwable) {
throw (Throwable) o;
}
return o;
}
-
+
public boolean equals(Object other) {
if (!(other instanceof SerializablePerson)) {
return false;
diff --git a/spring-aop/src/test/java/test/beans/SideEffectBean.java b/spring-aop/src/test/java/test/beans/SideEffectBean.java
index ea8279e2c2d1..82871af75271 100644
--- a/spring-aop/src/test/java/test/beans/SideEffectBean.java
+++ b/spring-aop/src/test/java/test/beans/SideEffectBean.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,17 +22,17 @@
* @author Rod Johnson
*/
public class SideEffectBean {
-
+
private int count;
-
+
public void setCount(int count) {
this.count = count;
}
-
+
public int getCount() {
return this.count;
}
-
+
public void doWork() {
++count;
}
diff --git a/spring-aop/src/test/java/test/beans/TestBean.java b/spring-aop/src/test/java/test/beans/TestBean.java
index 8f14fd61a2c5..14d3d039fdbb 100644
--- a/spring-aop/src/test/java/test/beans/TestBean.java
+++ b/spring-aop/src/test/java/test/beans/TestBean.java
@@ -411,4 +411,4 @@ public String toString() {
return this.name;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java b/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java
index 7920111e2e88..211e10102347 100644
--- a/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java
+++ b/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java
@@ -20,9 +20,9 @@
/**
* Used for testing pointcut matching.
- *
+ *
* @see AspectJExpressionPointcutTests#testWithinRootAndSubpackages()
- *
+ *
* @author Chris Beams
*/
public class DeepBean {
diff --git a/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java b/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java
index 4d9355f616f8..6d50c8512240 100644
--- a/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java
+++ b/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
private final Map componentDefinitions = new LinkedHashMap(8);
- private final Map aliasMap = new LinkedHashMap(8);
+ private final Map> aliasMap = new LinkedHashMap>(8);
private final List imports = new LinkedList();
@@ -67,18 +67,17 @@ public ComponentDefinition[] getComponentDefinitions() {
return collection.toArray(new ComponentDefinition[collection.size()]);
}
- @SuppressWarnings("unchecked")
public void aliasRegistered(AliasDefinition aliasDefinition) {
- List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
+ List aliases = this.aliasMap.get(aliasDefinition.getBeanName());
if(aliases == null) {
- aliases = new ArrayList();
+ aliases = new ArrayList();
this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
}
aliases.add(aliasDefinition);
}
public List> getAliases(String beanName) {
- List> aliases = (List>) this.aliasMap.get(beanName);
+ List> aliases = this.aliasMap.get(beanName);
return aliases == null ? null : Collections.unmodifiableList(aliases);
}
diff --git a/spring-aop/src/test/java/test/util/SerializationTestUtils.java b/spring-aop/src/test/java/test/util/SerializationTestUtils.java
index 74130ff343cf..8fd73e3cfb06 100644
--- a/spring-aop/src/test/java/test/util/SerializationTestUtils.java
+++ b/spring-aop/src/test/java/test/util/SerializationTestUtils.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2009 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -63,7 +63,7 @@ public static Object serializeAndDeserialize(Object o) throws IOException, Class
oos.flush();
baos.flush();
byte[] bytes = baos.toByteArray();
-
+
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(is);
Object o2 = ois.readObject();
@@ -84,7 +84,7 @@ public void testWithNonSerializableObject() throws IOException {
public void testWithSerializableObject() throws Exception {
int x = 5;
int y = 10;
- Point p = new Point(x, y);
+ Object p = new Point(x, y);
assertTrue(p instanceof Serializable);
testSerialization(p);
diff --git a/spring-aop/src/test/java/test/util/TestResourceUtils.java b/spring-aop/src/test/java/test/util/TestResourceUtils.java
index bae2b829acda..03303e78a549 100644
--- a/spring-aop/src/test/java/test/util/TestResourceUtils.java
+++ b/spring-aop/src/test/java/test/util/TestResourceUtils.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,29 +18,65 @@
import static java.lang.String.format;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
/**
* Convenience utilities for common operations with test resources.
*
* @author Chris Beams
+ * @author Phillip Webb
*/
public class TestResourceUtils {
/**
- * Loads a {@link ClassPathResource} qualified by the simple name of clazz,
- * and relative to the package for clazz.
- *
- * Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml',
- * this method will return a ClassPathResource representing com/foo/BarTests-context.xml
- *
- *
Intended for use loading context configuration XML files within JUnit tests.
- *
+ * Loads a {@link ClassPathResource} qualified by the simple name of clazz, and relative to the package for clazz.
+ *
+ *
+ * Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', this method will return a
+ * ClassPathResource representing com/foo/BarTests-context.xml
+ *
+ *
+ * Intended for use loading context configuration XML files within JUnit tests.
+ *
+ * @param clazz
+ * @param resourceSuffix
+ */
+ public static ClassPathResource qualifiedResource(Class> clazz,
+ String resourceSuffix) {
+ return new ClassPathResource(format("%s-%s", clazz.getSimpleName(),
+ resourceSuffix), clazz);
+ }
+
+ /**
+ * Creates a {@link DefaultListableBeanFactory} using a {@link #qualifiedResource(Class, String) qualified XML
+ * resource}.
+ *
* @param clazz
* @param resourceSuffix
*/
- public static ClassPathResource qualifiedResource(Class> clazz, String resourceSuffix) {
- return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz);
+ public static DefaultListableBeanFactory beanFactoryFromQualifiedResource(
+ Class> clazz, String resourceSuffix) {
+ return beanFactoryFromQualifiedResource(clazz, resourceSuffix, null);
}
+ /**
+ * Creates a {@link DefaultListableBeanFactory} using a {@link #qualifiedResource(Class, String) qualified XML
+ * resource}.
+ *
+ * @param clazz
+ * @param resourceSuffix
+ * @param parentBeanFactory
+ */
+ public static DefaultListableBeanFactory beanFactoryFromQualifiedResource(
+ Class> clazz, String resourceSuffix, BeanFactory parentBeanFactory) {
+ DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(
+ parentBeanFactory);
+ XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
+ ClassPathResource resource = qualifiedResource(clazz, resourceSuffix);
+ reader.loadBeanDefinitions(resource);
+ return beanFactory;
+ }
}
diff --git a/spring-aop/src/test/java/test/util/TimeStamped.java b/spring-aop/src/test/java/test/util/TimeStamped.java
index 052b56ff7387..484d5dda44bb 100644
--- a/spring-aop/src/test/java/test/util/TimeStamped.java
+++ b/spring-aop/src/test/java/test/util/TimeStamped.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2008 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,7 @@
* @author Rod Johnson
*/
public interface TimeStamped {
-
+
/**
* Return the timestamp for this object.
* @return long the timestamp for this object,
diff --git a/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java b/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java
index 13597f9a97ec..9aca558660f7 100644
--- a/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java
+++ b/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java
@@ -17,7 +17,7 @@
/**
* Marker interface for domain object that need DI through aspects.
- *
+ *
* @author Ramnivas Laddad
* @since 2.5
*/
diff --git a/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java b/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java
index 51347810dd07..8534fd76b5a3 100644
--- a/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java
+++ b/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java
@@ -29,7 +29,7 @@
* Configurable}.
*
*
This configuration class is automatically imported when using the @{@link
- * EnableSpringConfigured} annotation. See {@code @EnableSpringConfigured} Javadoc for
+ * EnableSpringConfigured} annotation. See {@code @EnableSpringConfigured} Javadoc for
* complete usage details.
*
* @author Chris Beams
diff --git a/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj b/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj
index 6ca2bd728c64..24e887098726 100644
--- a/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj
+++ b/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj
@@ -114,7 +114,7 @@ public abstract aspect AbstractMethodMockingControl percflow(mockStaticsTestMeth
if (responseType == CallResponse.return_) {
return call.returnValue(lastSig, args);
} else if(responseType == CallResponse.throw_) {
- return (RuntimeException)call.throwException(lastSig, args);
+ return call.throwException(lastSig, args);
} else if(responseType == CallResponse.nothing) {
// do nothing
}
diff --git a/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java b/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java
index 2dd6faa417a2..e6f8cb8459e7 100644
--- a/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java
+++ b/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
public class AutoProxyWithCodeStyleAspectsTests extends TestCase {
public void testNoAutoproxyingOfAjcCompiledAspects() {
- new ClassPathXmlApplicationContext("org/springframework/aop/aspectj/autoproxy/ajcAutoproxyTests.xml");
+ new ClassPathXmlApplicationContext("org/springframework/aop/aspectj/autoproxy/ajcAutoproxyTests.xml");
}
-
+
}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/Colour.java b/spring-aspects/src/test/java/org/springframework/beans/Colour.java
index 60dc333e0b47..4db722187d9d 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/Colour.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/Colour.java
@@ -32,4 +32,4 @@ private Colour(int code, String label) {
super(code, label);
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java
index 2bb41a9d5b68..db326041c361 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java
@@ -82,4 +82,4 @@ public boolean wasDestroyed() {
return destroyed;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java
index 7d87547b5f7f..115af8482600 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,4 +20,4 @@ public interface INestedTestBean {
public String getCompany();
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/IOther.java b/spring-aspects/src/test/java/org/springframework/beans/IOther.java
index 797486ec44e7..c77616637e6c 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/IOther.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/IOther.java
@@ -1,13 +1,13 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,4 +21,4 @@ public interface IOther {
void absquatulate();
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java b/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java
index cdf5ef510ddd..7b6ebcfc2fb6 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java
@@ -68,4 +68,4 @@ public interface ITestBean {
void unreliableFileOperation() throws IOException;
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java
index ddb091770ee7..4f3012666eac 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java
@@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) {
this.sortedMap = sortedMap;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java
index a06e15d150be..638f6b4a81eb 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,4 +57,4 @@ public String toString() {
return "NestedTestBean: " + this.company;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/TestBean.java b/spring-aspects/src/test/java/org/springframework/beans/TestBean.java
index 7842bbfeacfe..4cd145c9bb7e 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/TestBean.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/TestBean.java
@@ -434,4 +434,4 @@ public String toString() {
return this.name;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java
index 16e2522d9344..aae9ff6cd75c 100644
--- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java
+++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,4 +30,4 @@ protected void setUp() throws Exception {
public void testSpringConfiguredAndAutoProxyUsedTogether() {
; // set up is sufficient to trigger failure if this is going to fail...
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java
index b3f9d4937b7c..943b3e281d62 100644
--- a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java
+++ b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2011 the original author or authors.
+ * Copyright 2010-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -593,4 +593,4 @@ public void testMultiConditionalCacheAndEvict() {
public void testClassMultiConditionalCacheAndEvict() {
testMultiConditionalCacheAndEvict(ccs);
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java b/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java
index a6d1b4f7bda1..88f00b851722 100644
--- a/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java
+++ b/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java
@@ -135,4 +135,4 @@ public Object multiConditionalCacheAndEvict(Object arg1) {
public Object multiUpdate(Object arg1) {
return arg1;
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java b/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java
index cdcb73b2cbcf..bd61e7435a99 100644
--- a/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java
+++ b/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java
@@ -18,7 +18,7 @@
/**
* Basic service interface.
- *
+ *
* @author Costin Leau
*/
public interface CacheableService {
@@ -67,4 +67,4 @@ public interface CacheableService {
T multiConditionalCacheAndEvict(Object arg1);
T multiUpdate(Object arg1);
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java b/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java
index e8938a804e0f..2ad5b84b71f8 100644
--- a/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java
+++ b/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java
@@ -25,7 +25,7 @@
/**
* Simple cacheable service
- *
+ *
* @author Costin Leau
*/
public class DefaultCacheableService implements CacheableService {
@@ -141,4 +141,4 @@ public Long multiConditionalCacheAndEvict(Object arg1) {
public Long multiUpdate(Object arg1) {
return Long.valueOf(arg1.toString());
}
-}
\ No newline at end of file
+}
diff --git a/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java b/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java
index e33e3aa3f3d1..8c1584fc99c1 100644
--- a/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java
+++ b/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ public void testNoArgIntReturn() {
playback();
Assert.assertEquals(expectedCount, Person.countPeople());
}
-
+
@Test(expected=PersistenceException.class)
public void testNoArgThrows() {
Person.countPeople();
@@ -64,7 +64,7 @@ public void testArgMethodMatches() {
Assert.assertEquals(found, Person.findPerson(id));
}
-
+
@Test
public void testLongSeriesOfCalls() {
long id1 = 13;
@@ -80,7 +80,7 @@ public void testLongSeriesOfCalls() {
Person.countPeople();
expectReturn(0);
playback();
-
+
Assert.assertEquals(found1, Person.findPerson(id1));
Assert.assertEquals(found2, Person.findPerson(id2));
Assert.assertEquals(found1, Person.findPerson(id1));
@@ -122,22 +122,22 @@ public void testReentrant() {
public void testRejectUnexpectedCall() {
new Delegate().rejectUnexpectedCall();
}
-
+
@Test(expected=IllegalStateException.class)
public void testFailTooFewCalls() {
new Delegate().failTooFewCalls();
}
-
+
@Test
public void testEmpty() {
// Test that verification check doesn't blow up if no replay() call happened
}
-
+
@Test(expected=IllegalStateException.class)
public void testDoesntEverReplay() {
new Delegate().doesntEverReplay();
}
-
+
@Test(expected=IllegalStateException.class)
public void testDoesntEverSetReturn() {
new Delegate().doesntEverSetReturn();
diff --git a/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java b/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java
index c99dfe0c2e33..ad9bac544385 100644
--- a/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java
+++ b/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ public void testArgMethodNoMatchExpectThrow() {
AnnotationDrivenStaticEntityMockingControl.playback();
Assert.assertEquals(found, Person.findPerson(id + 1));
}
-
+
@Test
public void failTooFewCalls() {
long id = 13;
@@ -69,7 +69,7 @@ public void failTooFewCalls() {
public void doesntEverReplay() {
Person.countPeople();
}
-
+
@Test
public void doesntEverSetReturn() {
Person.countPeople();
@@ -81,7 +81,7 @@ public void rejectUnexpectedCall() {
AnnotationDrivenStaticEntityMockingControl.playback();
Person.countPeople();
}
-
+
@Test(expected=RemoteException.class)
public void testVerificationFailsEvenWhenTestFailsInExpectedManner() throws RemoteException {
Person.countPeople();
diff --git a/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java b/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java
index d5c2531fbde5..563d61071495 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java
@@ -50,7 +50,7 @@ protected void doRollback(DefaultTransactionStatus status) {
++rollbacks;
--inflight;
}
-
+
public void clear() {
begun = commits = rollbacks = inflight = 0;
}
diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java
index 6351d55d0d7c..f718e0938552 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2006 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ public class ClassWithPrivateAnnotatedMember {
public void doSomething() {
doInTransaction();
}
-
+
@Transactional
private void doInTransaction() {}
}
diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java
index f681c81e844a..18763dcc7423 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2006 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ public class ClassWithProtectedAnnotatedMember {
public void doSomething() {
doInTransaction();
}
-
+
@Transactional
protected void doInTransaction() {}
}
diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java
index 19a115ea2143..7e8ef63d1657 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java
@@ -4,7 +4,7 @@
@Transactional
public interface ITransactional {
-
+
Object echo(Throwable t) throws Throwable;
}
diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java
index 22cc31ebc65c..437a1a4f07ce 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java
@@ -3,7 +3,7 @@
import org.springframework.transaction.annotation.Transactional;
public class MethodAnnotationOnClassWithNoInterface {
-
+
@Transactional(rollbackFor=InterruptedException.class)
public Object echo(Throwable t) throws Throwable {
if (t != null) {
@@ -11,9 +11,9 @@ public Object echo(Throwable t) throws Throwable {
}
return t;
}
-
+
public void noTransactionAttribute() {
-
+
}
}
diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java
index 9449b2bcf707..407a5e2e9919 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java
@@ -31,17 +31,17 @@
* @author Ramnivas Laddad
*/
public class TransactionAspectTests extends AbstractDependencyInjectionSpringContextTests {
-
+
private TransactionAspectSupport transactionAspect;
-
+
private CallCountingTransactionManager txManager;
-
+
private TransactionalAnnotationOnlyOnClassWithNoInterface annotationOnlyOnClassWithNoInterface;
-
+
private ClassWithProtectedAnnotatedMember beanWithAnnotatedProtectedMethod;
private ClassWithPrivateAnnotatedMember beanWithAnnotatedPrivateMethod;
-
+
private MethodAnnotationOnClassWithNoInterface methodAnnotationOnly = new MethodAnnotationOnClassWithNoInterface();
@@ -49,7 +49,7 @@ public void setAnnotationOnlyOnClassWithNoInterface(
TransactionalAnnotationOnlyOnClassWithNoInterface annotationOnlyOnClassWithNoInterface) {
this.annotationOnlyOnClassWithNoInterface = annotationOnlyOnClassWithNoInterface;
}
-
+
public void setClassWithAnnotatedProtectedMethod(ClassWithProtectedAnnotatedMember aBean) {
this.beanWithAnnotatedProtectedMethod = aBean;
}
@@ -84,14 +84,14 @@ public void testCommitOnAnnotatedProtectedMethod() throws Throwable {
txManager.clear();
assertEquals(0, txManager.begun);
beanWithAnnotatedProtectedMethod.doInTransaction();
- assertEquals(1, txManager.commits);
+ assertEquals(1, txManager.commits);
}
public void testCommitOnAnnotatedPrivateMethod() throws Throwable {
txManager.clear();
assertEquals(0, txManager.begun);
beanWithAnnotatedPrivateMethod.doSomething();
- assertEquals(1, txManager.commits);
+ assertEquals(1, txManager.commits);
}
public void testNoCommitOnNonAnnotatedNonPublicMethodInTransactionalType() throws Throwable {
@@ -100,28 +100,28 @@ public void testNoCommitOnNonAnnotatedNonPublicMethodInTransactionalType() throw
annotationOnlyOnClassWithNoInterface.nonTransactionalMethod();
assertEquals(0,txManager.begun);
}
-
+
public void testCommitOnAnnotatedMethod() throws Throwable {
txManager.clear();
assertEquals(0, txManager.begun);
methodAnnotationOnly.echo(null);
assertEquals(1, txManager.commits);
}
-
-
+
+
public static class NotTransactional {
public void noop() {
}
}
-
+
public void testNotTransactional() throws Throwable {
txManager.clear();
assertEquals(0, txManager.begun);
new NotTransactional().noop();
assertEquals(0, txManager.begun);
}
-
-
+
+
public void testDefaultCommitOnAnnotatedClass() throws Throwable {
testRollback(new TransactionOperationCallback() {
public Object performTransactionalOperation() throws Throwable {
@@ -129,7 +129,7 @@ public Object performTransactionalOperation() throws Throwable {
}
}, false);
}
-
+
public void testDefaultRollbackOnAnnotatedClass() throws Throwable {
testRollback(new TransactionOperationCallback() {
public Object performTransactionalOperation() throws Throwable {
@@ -137,11 +137,11 @@ public Object performTransactionalOperation() throws Throwable {
}
}, true);
}
-
-
+
+
public static class SubclassOfClassWithTransactionalAnnotation extends TransactionalAnnotationOnlyOnClassWithNoInterface {
}
-
+
public void testDefaultCommitOnSubclassOfAnnotatedClass() throws Throwable {
testRollback(new TransactionOperationCallback() {
public Object performTransactionalOperation() throws Throwable {
@@ -149,10 +149,10 @@ public Object performTransactionalOperation() throws Throwable {
}
}, false);
}
-
+
public static class SubclassOfClassWithTransactionalMethodAnnotation extends MethodAnnotationOnClassWithNoInterface {
}
-
+
public void testDefaultCommitOnSubclassOfClassWithTransactionalMethodAnnotated() throws Throwable {
testRollback(new TransactionOperationCallback() {
public Object performTransactionalOperation() throws Throwable {
@@ -160,7 +160,7 @@ public Object performTransactionalOperation() throws Throwable {
}
}, false);
}
-
+
public static class ImplementsAnnotatedInterface implements ITransactional {
public Object echo(Throwable t) throws Throwable {
if (t != null) {
@@ -169,14 +169,14 @@ public Object echo(Throwable t) throws Throwable {
return t;
}
}
-
+
public void testDefaultCommitOnImplementationOfAnnotatedInterface() throws Throwable {
// testRollback(new TransactionOperationCallback() {
// public Object performTransactionalOperation() throws Throwable {
// return new ImplementsAnnotatedInterface().echo(new Exception());
// }
// }, false);
-
+
final Exception ex = new Exception();
testNotTransactional(new TransactionOperationCallback() {
public Object performTransactionalOperation() throws Throwable {
@@ -184,7 +184,7 @@ public Object performTransactionalOperation() throws Throwable {
}
}, ex);
}
-
+
/**
* Note: resolution does not occur. Thus we can't make a class transactional if
* it implements a transactionally annotated interface. This behaviour could only
@@ -198,15 +198,15 @@ public void testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotated
TransactionAttribute ta = atas.getTransactionAttribute(m, ImplementsAnnotatedInterface.class);
assertNull(ta);
}
-
-
+
+
public void testDefaultRollbackOnImplementationOfAnnotatedInterface() throws Throwable {
// testRollback(new TransactionOperationCallback() {
// public Object performTransactionalOperation() throws Throwable {
// return new ImplementsAnnotatedInterface().echo(new RuntimeException());
// }
// }, true);
-
+
final Exception rollbackProvokingException = new RuntimeException();
testNotTransactional(new TransactionOperationCallback() {
public Object performTransactionalOperation() throws Throwable {
@@ -215,7 +215,7 @@ public Object performTransactionalOperation() throws Throwable {
}, rollbackProvokingException);
}
-
+
protected void testRollback(TransactionOperationCallback toc, boolean rollback) throws Throwable {
txManager.clear();
assertEquals(0, txManager.begun);
@@ -228,13 +228,13 @@ protected void testRollback(TransactionOperationCallback toc, boolean rollback)
return;
}
}
-
+
if (rollback) {
assertEquals(1, txManager.rollbacks);
}
assertEquals(1, txManager.begun);
}
-
+
protected void testNotTransactional(TransactionOperationCallback toc, Throwable expected) throws Throwable {
txManager.clear();
assertEquals(0, txManager.begun);
@@ -251,7 +251,7 @@ protected void testNotTransactional(TransactionOperationCallback toc, Throwable
assertEquals(0, txManager.begun);
}
}
-
+
private interface TransactionOperationCallback {
diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java
index 691506baa035..93bd225f7ca1 100644
--- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java
+++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java
@@ -4,14 +4,14 @@
@Transactional
public class TransactionalAnnotationOnlyOnClassWithNoInterface {
-
+
public Object echo(Throwable t) throws Throwable {
if (t != null) {
throw t;
}
return t;
}
-
+
void nonTransactionalMethod() {
// no-op
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java b/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java
index c72277d2cf25..8febd8f010a8 100644
--- a/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java
@@ -105,7 +105,7 @@ public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean
// Redefined with public visibility.
@Override
- public Class getPropertyType(String propertyPath) {
+ public Class> getPropertyType(String propertyPath) {
return null;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java b/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java
index 46e45ba1efd3..01e40c0faca4 100644
--- a/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
*/
public class BeanInstantiationException extends FatalBeanException {
- private Class beanClass;
+ private Class> beanClass;
/**
@@ -33,7 +33,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);
}
@@ -43,7 +43,7 @@ public BeanInstantiationException(Class beanClass, String msg) {
* @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;
}
@@ -51,7 +51,7 @@ public BeanInstantiationException(Class beanClass, String msg, Throwable cause)
/**
* Return the offending bean class.
*/
- public Class getBeanClass() {
+ public Class> getBeanClass() {
return beanClass;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java
index aea348d6fdda..abd06723c22b 100644
--- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java
+++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor {
* @return the type of the wrapped bean instance,
* or null if no wrapped object has been set
*/
- Class getWrappedClass();
+ Class> getWrappedClass();
/**
* Obtain the PropertyDescriptors for the wrapped object
diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
index efe6fccbcc21..12ee9db4968a 100644
--- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
+++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
@@ -225,7 +225,7 @@ public final Object getWrappedInstance() {
return this.object;
}
- public final Class getWrappedClass() {
+ public final Class> getWrappedClass() {
return (this.object != null ? this.object.getClass() : null);
}
@@ -248,7 +248,7 @@ public final Object getRootInstance() {
* 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);
}
@@ -306,7 +306,7 @@ public AccessControlContext getSecurityContext() {
* 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;
@@ -354,7 +354,7 @@ protected PropertyDescriptor getPropertyDescriptorInternal(String propertyName)
}
@Override
- public Class getPropertyType(String propertyName) throws BeansException {
+ public Class> getPropertyType(String propertyName) throws BeansException {
try {
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
if (pd != null) {
@@ -368,7 +368,7 @@ public Class getPropertyType(String propertyName) throws BeansException {
}
// 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;
}
@@ -559,7 +559,7 @@ private BeanWrapperImpl getNestedBeanWrapper(String nestedProperty) {
propertyValue = setDefaultValue(tokens);
}
else {
- throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + canonicalName);
+ throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + canonicalName);
}
}
@@ -701,7 +701,8 @@ public Object getPropertyValue(String propertyName) throws BeansException {
return nestedBw.getPropertyValue(tokens);
}
- private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
+ @SuppressWarnings("rawtypes")
+ private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
String propertyName = tokens.canonicalName;
String actualName = tokens.actualName;
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);
@@ -723,7 +724,7 @@ public Object run() {
readMethod.setAccessible(true);
}
}
-
+
Object value;
if (System.getSecurityManager() != null) {
try {
@@ -738,10 +739,10 @@ public Object run() throws Exception {
}
}
else {
- value = readMethod.invoke(object, (Object[]) null);
+ value = readMethod.invoke(object, (Object[]) null);
}
-
- if (tokens.keys != null) {
+
+ if (tokens.keys != null) {
if (value == null) {
if (this.autoGrowNestedPaths) {
value = setDefaultValue(tokens.actualName);
@@ -749,9 +750,9 @@ public Object run() throws Exception {
else {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + propertyName,
"Cannot access indexed value of property referenced in indexed " +
- "property path '" + propertyName + "': returned null");
+ "property path '" + propertyName + "': returned null");
}
- }
+ }
String indexedPropertyName = tokens.actualName;
// apply indexes and map keys
for (int i = 0; i < tokens.keys.length; i++) {
@@ -759,7 +760,7 @@ public Object run() throws Exception {
if (value == null) {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + propertyName,
"Cannot access indexed value of property referenced in indexed " +
- "property path '" + propertyName + "': returned null");
+ "property path '" + propertyName + "': returned null");
}
else if (value.getClass().isArray()) {
int index = Integer.parseInt(key);
@@ -767,9 +768,9 @@ else if (value.getClass().isArray()) {
value = Array.get(value, index);
}
else if (value instanceof List) {
- int index = Integer.parseInt(key);
+ int index = Integer.parseInt(key);
List list = (List) value;
- growCollectionIfNecessary(list, index, indexedPropertyName, pd, i + 1);
+ growCollectionIfNecessary(list, index, indexedPropertyName, pd, i + 1);
value = list.get(index);
}
else if (value instanceof Set) {
@@ -804,7 +805,7 @@ else if (value instanceof Map) {
"Property referenced in indexed property path '" + propertyName +
"' is neither an array nor a List nor a Set nor a Map; returned value was [" + value + "]");
}
- indexedPropertyName += PROPERTY_KEY_PREFIX + key + PROPERTY_KEY_SUFFIX;
+ indexedPropertyName += PROPERTY_KEY_PREFIX + key + PROPERTY_KEY_SUFFIX;
}
}
return value;
@@ -852,7 +853,7 @@ private Object growArrayIfNecessary(Object array, int index, String name) {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private void growCollectionIfNecessary(
Collection collection, int index, String name, PropertyDescriptor pd, int nestingLevel) {
@@ -861,7 +862,7 @@ private void growCollectionIfNecessary(
}
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));
@@ -908,7 +909,7 @@ public void setPropertyValue(PropertyValue pv) throws BeansException {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private void setPropertyValue(PropertyTokenHolder tokens, PropertyValue pv) throws BeansException {
String propertyName = tokens.canonicalName;
String actualName = tokens.actualName;
@@ -965,7 +966,7 @@ private void setPropertyValue(PropertyTokenHolder tokens, PropertyValue pv) thro
}
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;
int index = Integer.parseInt(key);
@@ -1002,9 +1003,9 @@ else if (propValue instanceof List) {
}
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;
// IMPORTANT: Do not pass full property name in here - property editors
diff --git a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
index 2e9dde90b883..3d250925da25 100644
--- a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
+++ b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
@@ -76,7 +76,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 classCache = new WeakHashMap();
+ static final Map, Object> classCache = Collections.synchronizedMap(new WeakHashMap, Object>());
/**
@@ -111,8 +111,8 @@ public static void clearClassLoader(ClassLoader classLoader) {
return;
}
synchronized (classCache) {
- for (Iterator it = classCache.keySet().iterator(); it.hasNext();) {
- Class beanClass = it.next();
+ for (Iterator> it = classCache.keySet().iterator(); it.hasNext();) {
+ Class> beanClass = it.next();
if (isUnderneathClassLoader(beanClass.getClassLoader(), classLoader)) {
it.remove();
}
@@ -136,15 +136,16 @@ public static void clearClassLoader(ClassLoader classLoader) {
* @return the corresponding CachedIntrospectionResults
* @throws BeansException in case of introspection failure
*/
- static CachedIntrospectionResults forClass(Class beanClass) throws BeansException {
+ static CachedIntrospectionResults forClass(Class> beanClass) throws BeansException {
CachedIntrospectionResults results;
Object value;
synchronized (classCache) {
value = classCache.get(beanClass);
}
if (value instanceof Reference) {
- Reference ref = (Reference) value;
- results = (CachedIntrospectionResults) ref.get();
+ @SuppressWarnings("unchecked")
+ Reference ref = (Reference) value;
+ results = ref.get();
}
else {
results = (CachedIntrospectionResults) value;
@@ -228,7 +229,7 @@ private static boolean isUnderneathClassLoader(ClassLoader candidate, ClassLoade
* @param beanClass the bean class to analyze
* @throws BeansException in case of introspection failure
*/
- private CachedIntrospectionResults(Class beanClass) throws BeansException {
+ private CachedIntrospectionResults(Class> beanClass, boolean cacheFullMetadata) throws BeansException {
try {
if (logger.isTraceEnabled()) {
logger.trace("Getting BeanInfo for class [" + beanClass.getName() + "]");
@@ -251,7 +252,7 @@ private CachedIntrospectionResults(Class beanClass) throws BeansException {
// garbage collection on class loader shutdown - we cache it here anyway,
// in a GC-friendly manner. In contrast to CachedIntrospectionResults,
// Introspector does not use WeakReferences as values of its WeakHashMap!
- Class classToFlush = beanClass;
+ Class> classToFlush = beanClass;
do {
Introspector.flushFromCaches(classToFlush);
classToFlush = classToFlush.getSuperclass();
@@ -289,7 +290,7 @@ BeanInfo getBeanInfo() {
return this.beanInfo;
}
- Class getBeanClass() {
+ Class> getBeanClass() {
return this.beanInfo.getBeanDescriptor().getBeanClass();
}
@@ -317,7 +318,7 @@ PropertyDescriptor[] getPropertyDescriptors() {
return pds;
}
- private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class beanClass, PropertyDescriptor pd) {
+ private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class> beanClass, PropertyDescriptor pd) {
try {
return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(),
pd.getWriteMethod(), pd.getPropertyEditorClass());
diff --git a/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java b/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java
index afd6a0fc0948..dcb29c8fa371 100644
--- a/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ public class ConversionNotSupportedException extends TypeMismatchException {
* @param requiredType the required target type (or null if not known)
* @param cause the root cause (may be null)
*/
- public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent, Class requiredType, Throwable cause) {
+ public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent, Class> requiredType, Throwable cause) {
super(propertyChangeEvent, requiredType, cause);
}
@@ -43,7 +43,7 @@ public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent,
* @param requiredType the required target type (or null if not known)
* @param cause the root cause (may be null)
*/
- public ConversionNotSupportedException(Object value, Class requiredType, Throwable cause) {
+ public ConversionNotSupportedException(Object value, Class> requiredType, Throwable cause) {
super(value, requiredType, cause);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java b/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java
index a2d5ee7af3f9..9cfd3c041004 100644
--- a/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,23 +40,23 @@
*/
class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor {
- private final Class beanClass;
+ private final Class> beanClass;
private final Method readMethod;
private final Method writeMethod;
- private final Class propertyEditorClass;
+ private final Class> propertyEditorClass;
private volatile Set ambiguousWriteMethods;
- private Class propertyType;
+ private Class> propertyType;
private MethodParameter writeMethodParameter;
- public GenericTypeAwarePropertyDescriptor(Class beanClass, String propertyName,
- Method readMethod, Method writeMethod, Class propertyEditorClass)
+ public GenericTypeAwarePropertyDescriptor(Class> beanClass, String propertyName,
+ Method readMethod, Method writeMethod, Class> propertyEditorClass)
throws IntrospectionException {
super(propertyName, null, null);
@@ -95,7 +95,7 @@ public GenericTypeAwarePropertyDescriptor(Class beanClass, String propertyName,
public Class> getBeanClass() {
return this.beanClass;
}
-
+
@Override
public Method getReadMethod() {
return this.readMethod;
@@ -118,12 +118,12 @@ public Method getWriteMethodForActualAccess() {
}
@Override
- public Class getPropertyEditorClass() {
+ public Class> getPropertyEditorClass() {
return this.propertyEditorClass;
}
@Override
- public synchronized Class getPropertyType() {
+ public synchronized Class> getPropertyType() {
if (this.propertyType == null) {
if (this.readMethod != null) {
this.propertyType = GenericTypeResolver.resolveReturnType(this.readMethod, this.beanClass);
diff --git a/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java b/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java
index d1c976a5a20b..44c22a06d386 100644
--- a/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
*/
public class InvalidPropertyException extends FatalBeanException {
- private Class beanClass;
+ private Class> beanClass;
private String propertyName;
@@ -36,7 +36,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);
}
@@ -47,7 +47,7 @@ public InvalidPropertyException(Class beanClass, String propertyName, String msg
* @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;
@@ -56,7 +56,7 @@ public InvalidPropertyException(Class beanClass, String propertyName, String msg
/**
* Return the offending bean class.
*/
- public Class getBeanClass() {
+ public Class> getBeanClass() {
return beanClass;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java b/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java
index 6a9c0eac84a4..49d1398d7bcf 100644
--- a/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java
@@ -30,7 +30,7 @@ public class MethodInvocationException extends PropertyAccessException {
* Error code that a method invocation error will be registered with.
*/
public static final String ERROR_CODE = "methodInvocation";
-
+
/**
* Create a new MethodInvocationException.
diff --git a/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java b/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java
index 470a705dd595..3d9f2236ebbd 100644
--- a/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java
+++ b/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ public MutablePropertyValues(Map, ?> original) {
// There is no replacement of existing property values.
if (original != null) {
this.propertyValueList = new ArrayList(original.size());
- for (Map.Entry entry : original.entrySet()) {
+ for (Map.Entry,?> entry : original.entrySet()) {
this.propertyValueList.add(new PropertyValue(entry.getKey().toString(), entry.getValue()));
}
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java b/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java
index 49ba7d795a33..acfe61d0e531 100644
--- a/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ 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?");
@@ -42,7 +42,7 @@ public NotReadablePropertyException(Class beanClass, String propertyName) {
* @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);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java b/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java
index 73b607edb116..4d854ef8d5d5 100644
--- a/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ 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?");
@@ -46,7 +46,7 @@ public NotWritablePropertyException(Class beanClass, String propertyName) {
* @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);
}
@@ -57,7 +57,7 @@ public NotWritablePropertyException(Class beanClass, String propertyName, String
* @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);
}
@@ -69,7 +69,7 @@ public NotWritablePropertyException(Class beanClass, String propertyName, String
* @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;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java b/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java
index 40c593c4440a..6f8003f274df 100644
--- a/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,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");
}
@@ -42,7 +42,7 @@ public NullValueInNestedPathException(Class beanClass, String propertyName) {
* @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);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java
index 830ea5f40d06..cb17396c8c8f 100644
--- a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java
@@ -30,7 +30,7 @@
public abstract class PropertyAccessException extends BeansException implements ErrorCoded {
private transient PropertyChangeEvent propertyChangeEvent;
-
+
/**
* Create a new PropertyAccessException.
diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java
index c8b8edb63f75..06b54dfc0417 100644
--- a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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:
@@ -190,8 +190,7 @@ public interface PropertyAccessor {
* successfully updated.
* @see #setPropertyValues(PropertyValues, boolean, boolean)
*/
- void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown)
- throws BeansException;
+ void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) throws BeansException;
/**
* Perform a batch update with full control over behavior.
@@ -213,6 +212,6 @@ void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown)
* successfully updated.
*/
void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid)
- throws BeansException;
+ throws BeansException;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java b/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java
index d7a574cc433a..ad2b986f69ea 100644
--- a/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,7 +129,7 @@ public void printStackTrace(PrintWriter pw) {
}
@Override
- public boolean contains(Class exType) {
+ public boolean contains(Class> exType) {
if (exType == null) {
return false;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java
index 9e141fde3a9f..56dddc4de56c 100644
--- a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java
+++ b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java
@@ -31,7 +31,7 @@
* @see java.beans.PropertyEditor
*/
public interface PropertyEditorRegistrar {
-
+
/**
* Register custom {@link java.beans.PropertyEditor PropertyEditors} with
* the given PropertyEditorRegistry.
diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java
index 2b547c0edf6e..e92eeac34171 100644
--- a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java
+++ b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java b/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java
index 0c6829065090..0b72a72df846 100644
--- a/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java
+++ b/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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 @@ public static PropertyMatches forProperty(String propertyName, Class beanClass)
* @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 @@ public static PropertyMatches forProperty(String propertyName, Class beanClass,
/**
* 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);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java b/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java
index e2180a077e79..008d630ffcaf 100644
--- a/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java
+++ b/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +26,12 @@
* @see PropertyValue
*/
public interface PropertyValues {
-
- /**
+
+ /**
* Return an array of the PropertyValue objects held in this object.
*/
- PropertyValue[] getPropertyValues();
-
+ PropertyValue[] getPropertyValues();
+
/**
* Return the property value with the given name, if any.
* @param propertyName the name to search for
diff --git a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
index 9b47e794439c..6d3d0db5baf3 100644
--- a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
+++ b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
@@ -140,7 +140,7 @@ public T convertIfNecessary(
* @return the new value, possibly the result of type conversion
* @throws IllegalArgumentException if type conversion failed
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public T convertIfNecessary(String propertyName, Object oldValue, Object newValue,
Class requiredType, TypeDescriptor typeDescriptor) throws IllegalArgumentException {
@@ -237,6 +237,7 @@ else if (convertedValue instanceof String && !requiredType.isInstance(convertedV
// It's an empty enum identifier: reset the enum value to null.
return null;
}
+
convertedValue = attemptToConvertStringToEnum(requiredType, trimmedValue, convertedValue);
standardConversion = true;
}
@@ -328,9 +329,9 @@ private Object attemptToConvertStringToEnum(Class> requiredType, String trimme
* @param requiredType the type to find an editor for
* @return the corresponding editor, or null if none
*/
- private PropertyEditor findDefaultEditor(Class requiredType) {
+ protected PropertyEditor findDefaultEditor(Class> requiredType, TypeDescriptor typeDescriptor) {
PropertyEditor editor = null;
- if (requiredType != null) {
+ if (editor == null && requiredType != null) {
// No custom editor -> check BeanWrapperImpl's default editors.
editor = this.propertyEditorRegistry.getDefaultEditor(requiredType);
if (editor == null && !String.class.equals(requiredType)) {
@@ -453,7 +454,8 @@ private Object doConvertTextValue(Object oldValue, String newTextValue, Property
return editor.getValue();
}
- private Object convertToTypedArray(Object input, String propertyName, Class> componentType) {
+ @SuppressWarnings("rawtypes")
+ protected Object convertToTypedArray(Object input, String propertyName, Class> componentType) {
if (input instanceof Collection) {
// Convert Collection elements to array elements.
Collection coll = (Collection) input;
@@ -491,8 +493,8 @@ else if (input.getClass().isArray()) {
}
}
- @SuppressWarnings("unchecked")
- private Collection convertToTypedCollection(
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected Collection convertToTypedCollection(
Collection original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
if (!Collection.class.isAssignableFrom(requiredType)) {
@@ -573,8 +575,8 @@ private Collection convertToTypedCollection(
return (originalAllowed ? original : convertedCopy);
}
- @SuppressWarnings("unchecked")
- private Map convertToTypedMap(
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected Map convertToTypedMap(
Map original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
if (!Map.class.isAssignableFrom(requiredType)) {
@@ -671,7 +673,7 @@ private String buildKeyedPropertyName(String propertyName, Object key) {
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));
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java b/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java
index f2d05a31f0fe..cc5d9cbcfd18 100644
--- a/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class TypeMismatchException extends PropertyAccessException {
private transient Object value;
- private Class requiredType;
+ private Class> requiredType;
/**
@@ -44,7 +44,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);
}
@@ -54,7 +54,7 @@ public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requ
* @param requiredType the required target type (or null if not known)
* @param cause the root cause (may be 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()) + "'" +
@@ -72,7 +72,7 @@ public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requ
* @param value the offending value that couldn't be converted (may be null)
* @param requiredType the required target type (or null if not known)
*/
- public TypeMismatchException(Object value, Class requiredType) {
+ public TypeMismatchException(Object value, Class> requiredType) {
this(value, requiredType, null);
}
@@ -82,7 +82,7 @@ public TypeMismatchException(Object value, Class requiredType) {
* @param requiredType the required target type (or null if not known)
* @param cause the root cause (may be 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);
@@ -102,7 +102,7 @@ public Object getValue() {
/**
* Return the required target type, if any.
*/
- public Class getRequiredType() {
+ public Class> getRequiredType() {
return this.requiredType;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java b/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java
index db3c74965bd0..b73166ca2350 100644
--- a/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java
+++ b/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java
@@ -45,21 +45,7 @@ public abstract class AnnotationBeanUtils {
* @see org.springframework.beans.BeanWrapper
*/
public static void copyPropertiesToBean(Annotation ann, Object bean, String... excludedProperties) {
- copyPropertiesToBean(ann, bean, null, excludedProperties);
- }
-
- /**
- * Copy the properties of the supplied {@link Annotation} to the supplied target bean.
- * Any properties defined in excludedProperties will not be copied.
- * A specified value resolver may resolve placeholders in property values, for example.
- * @param ann the annotation to copy from
- * @param bean the bean instance to copy to
- * @param valueResolver a resolve to post-process String property values (may be null)
- * @param excludedProperties the names of excluded properties, if any
- * @see org.springframework.beans.BeanWrapper
- */
- public static void copyPropertiesToBean(Annotation ann, Object bean, StringValueResolver valueResolver, String... excludedProperties) {
- Set excluded = new HashSet(Arrays.asList(excludedProperties));
+ Set excluded = new HashSet(Arrays.asList(excludedProperties));
Method[] annotationProperties = ann.annotationType().getDeclaredMethods();
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(bean);
for (Method annotationProperty : annotationProperties) {
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java b/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java
index fb107425c36f..1b3f306b0c3e 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
/**
* Marker superinterface indicating that a bean is eligible to be
* notified by the Spring container of a particular framework object
- * through a callback-style method. Actual method signature is
+ * through a callback-style method. Actual method signature is
* determined by individual subinterfaces, but should typically
* consist of just one void-returning method that accepts a single
* argument.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java
index 486f9248e7dd..17e539805587 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -184,7 +184,7 @@ public void printStackTrace(PrintWriter pw) {
}
@Override
- public boolean contains(Class exClass) {
+ public boolean contains(Class> exClass) {
if (super.contains(exClass)) {
return true;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java
index ab2f2531b0df..1aff05da8a04 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java
@@ -44,4 +44,4 @@ public BeanExpressionException(String msg, Throwable cause) {
super(msg, cause);
}
-}
\ No newline at end of file
+}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java
index 0e58200ad960..025185567121 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java
@@ -115,7 +115,7 @@ public static String originalBeanName(String name) {
public static int countBeansIncludingAncestors(ListableBeanFactory lbf) {
return beanNamesIncludingAncestors(lbf).length;
}
-
+
/**
* Return all bean names in the factory, including ancestor factories.
* @param lbf the bean factory
@@ -139,7 +139,7 @@ public static String[] beanNamesIncludingAncestors(ListableBeanFactory lbf) {
* @param type the type that beans must match
* @return the array of matching bean names, or an empty array if none
*/
- public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type) {
+ public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class> type) {
Assert.notNull(lbf, "ListableBeanFactory must not be null");
String[] result = lbf.getBeanNamesForType(type);
if (lbf instanceof HierarchicalBeanFactory) {
@@ -181,7 +181,7 @@ public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lb
* @return the array of matching bean names, or an empty array if none
*/
public static String[] beanNamesForTypeIncludingAncestors(
- ListableBeanFactory lbf, Class type, boolean includeNonSingletons, boolean allowEagerInit) {
+ ListableBeanFactory lbf, Class> type, boolean includeNonSingletons, boolean allowEagerInit) {
Assert.notNull(lbf, "ListableBeanFactory must not be null");
String[] result = lbf.getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java
index 7146ec7806ba..dfc8161010e0 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2005 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,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);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java
index efdea3ab3d0b..3aac1008a4e5 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,10 +30,10 @@ 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;
/**
@@ -43,7 +43,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;
@@ -62,14 +62,14 @@ public String getBeanName() {
/**
* 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;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java
index 12fdeb853bc4..536c2e695c8a 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java
index 20eb7845b3dc..f471915b0a55 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java
@@ -30,7 +30,7 @@
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory
*/
public interface HierarchicalBeanFactory extends BeanFactory {
-
+
/**
* Return the parent bean factory, or null if there is none.
*/
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java
index a21912d31ca3..420aefb2c0bd 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,7 @@
* Interface to be implemented by beans that need to react once all their
* properties have been set by a BeanFactory: for example, to perform custom
* initialization, or merely to check that all mandatory properties have been set.
- *
+ *
* An alternative to implementing InitializingBean is specifying a custom
* init-method, for example in an XML bean definition.
* For a list of all bean lifecycle methods, see the BeanFactory javadocs.
@@ -33,7 +33,7 @@
* @see org.springframework.context.ApplicationContextAware
*/
public interface InitializingBean {
-
+
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
* (and satisfied BeanFactoryAware and ApplicationContextAware).
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
index e7c08c2dc550..64e86dc2c4bf 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
@@ -84,7 +84,7 @@ public interface ListableBeanFactory extends BeanFactory {
* or an empty array if none defined
*/
String[] getBeanDefinitionNames();
-
+
/**
* Return the names of beans matching the given type (including subclasses),
* judging from either bean definitions or the value of getObjectType
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java b/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java
index 746208955669..0abda22dc47f 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java
@@ -32,7 +32,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
/** Name of the missing bean. */
private String beanName;
- /** Required type of the missing bean. */
+ /** Required bean type */
private Class> beanType;
@@ -73,7 +73,7 @@ public NoSuchBeanDefinitionException(Class> type, String message) {
super("No unique bean of type [" + type.getName() + "] is defined: " + message);
this.beanType = type;
}
-
+
/**
* Create a new {@code NoSuchBeanDefinitionException}.
* @param type required type of the missing bean
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java b/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java
index ae2cc0de0ae2..0cc75c8a8741 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@ public UnsatisfiedDependencyException(
* @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 " +
@@ -85,7 +85,7 @@ public UnsatisfiedDependencyException(
* @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);
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java
index b502384d7039..9a607de3efd6 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java
index 8425921237e6..61eea7a094a6 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java
@@ -40,7 +40,7 @@
* which accesses shared Spring {@link BeanFactory} instances.
*
* Please see the warning in BeanFactoryLocator's javadoc about appropriate usage
- * of singleton style BeanFactoryLocator implementations. It is the opinion of the
+ * of singleton style BeanFactoryLocator implementations. It is the opinion of the
* Spring team that the use of this class and similar classes is unnecessary except
* (sometimes) for a small amount of glue code. Excessive usage will lead to code
* that is more tightly coupled, and harder to modify or test.
@@ -50,11 +50,11 @@
* searched for is 'classpath*:beanRefFactory.xml', with the Spring-standard
* 'classpath*:' prefix ensuring that if the classpath contains multiple copies
* of this file (perhaps one in each component jar) they will be combined. To
- * override the default resource name, instead of using the no-arg
+ * override the default resource name, instead of using the no-arg
* {@link #getInstance()} method, use the {@link #getInstance(String selector)}
* variant, which will treat the 'selector' argument as the resource name to
* search for.
- *
+ *
* The purpose of this 'outer' BeanFactory is to create and hold a copy of one
* or more 'inner' BeanFactory or ApplicationContext instances, and allow those
* to be obtained either directly or via an alias. As such, this class provides
@@ -80,10 +80,10 @@
* or created as three hierarchical ApplicationContexts, by one piece of code
* somewhere at application startup (perhaps a Servlet filter), from which all other
* code in the application would flow, obtained as beans from the context(s). However
- * when third party code enters into the picture, things can get problematic. If the
+ * when third party code enters into the picture, things can get problematic. If the
* third party code needs to create user classes, which should normally be obtained
* from a Spring BeanFactory/ApplicationContext, but can handle only newInstance()
- * style object creation, then some extra work is required to actually access and
+ * style object creation, then some extra work is required to actually access and
* use object from a BeanFactory/ApplicationContext. One solutions is to make the
* class created by the third party code be just a stub or proxy, which gets the
* real object from a BeanFactory/ApplicationContext, and delegates to it. However,
@@ -101,7 +101,7 @@
*
*
Another use of SingletonBeanFactoryLocator, is to demand-load/use one or more
* BeanFactories/ApplicationContexts. Because the definition can contain one of more
- * BeanFactories/ApplicationContexts, which can be independent or in a hierarchy, if
+ * BeanFactories/ApplicationContexts, which can be independent or in a hierarchy, if
* they are set to lazy-initialize, they will only be created when actually requested
* for use.
*
@@ -111,9 +111,9 @@
*
*
<?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- *
+ *
* <beans>
- *
+ *
* <bean id="com.mycompany.myapp"
* class="org.springframework.context.support.ClassPathXmlApplicationContext">
* <constructor-arg>
@@ -124,7 +124,7 @@
* </list>
* </constructor-arg>
* </bean>
- *
+ *
* </beans>
*
*
@@ -133,7 +133,7 @@
*
* BeanFactoryLocator bfl = SingletonBeanFactoryLocator.getInstance();
* BeanFactoryReference bf = bfl.useBeanFactory("com.mycompany.myapp");
- * // now use some bean from factory
+ * // now use some bean from factory
* MyClass zed = bf.getFactory().getBean("mybean");
*
*
@@ -141,16 +141,16 @@
*
* <?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- *
+ *
* <beans>
- *
+ *
* <bean id="com.mycompany.myapp.util" lazy-init="true"
* class="org.springframework.context.support.ClassPathXmlApplicationContext">
* <constructor-arg>
* <value>com/mycompany/myapp/util/applicationContext.xml</value>
* </constructor-arg>
* </bean>
- *
+ *
* <!-- child of above -->
* <bean id="com.mycompany.myapp.dataaccess" lazy-init="true"
* class="org.springframework.context.support.ClassPathXmlApplicationContext">
@@ -161,7 +161,7 @@
* <ref bean="com.mycompany.myapp.util"/>
* </constructor-arg>
* </bean>
- *
+ *
* <!-- child of above -->
* <bean id="com.mycompany.myapp.services" lazy-init="true"
* class="org.springframework.context.support.ClassPathXmlApplicationContext">
@@ -172,7 +172,7 @@
* <ref bean="com.mycompany.myapp.dataaccess"/>
* </constructor-arg>
* </bean>
- *
+ *
* <!-- define an alias -->
* <bean id="com.mycompany.myapp.mypackage"
* class="java.lang.String">
@@ -180,7 +180,7 @@
* <value>com.mycompany.myapp.services</value>
* </constructor-arg>
* </bean>
- *
+ *
* </beans>
*
*
@@ -200,7 +200,7 @@
*
* <?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- *
+ *
* <beans>
* <bean id="com.mycompany.myapp.util" lazy-init="true"
* class="org.springframework.context.support.ClassPathXmlApplicationContext">
@@ -210,12 +210,12 @@
* </bean>
* </beans>
*
- *
+ *
* beanRefFactory.xml file inside jar for data-access module:
*
* <?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- *
+ *
* <beans>
* <!-- child of util -->
* <bean id="com.mycompany.myapp.dataaccess" lazy-init="true"
@@ -229,12 +229,12 @@
* </bean>
* </beans>
*
- *
+ *
* beanRefFactory.xml file inside jar for services module:
*
* <?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- *
+ *
* <beans>
* <!-- child of data-access -->
* <bean id="com.mycompany.myapp.services" lazy-init="true"
@@ -248,20 +248,20 @@
* </bean>
* </beans>
*
- *
+ *
* beanRefFactory.xml file inside jar for mypackage module. This doesn't
* create any of its own contexts, but allows the other ones to be referred to be
* a name known to this module:
*
* <?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
- *
+ *
* <beans>
* <!-- define an alias for "com.mycompany.myapp.services" -->
* <alias name="com.mycompany.myapp.services" alias="com.mycompany.myapp.mypackage"/>
* </beans>
*
- *
+ *
* @author Colin Sampaleanu
* @author Juergen Hoeller
* @see org.springframework.context.access.ContextSingletonBeanFactoryLocator
@@ -362,7 +362,7 @@ public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansExcept
logger.trace("Factory group with resource name [" + this.resourceLocation +
"] requested. Creating new instance.");
}
-
+
// Create the BeanFactory but don't initialize it.
BeanFactory groupContext = createDefinition(this.resourceLocation, factoryKey);
@@ -446,7 +446,7 @@ protected BeanFactory createDefinition(String resourceLocation, String factoryKe
return factory;
}
-
+
/**
* Instantiate singletons and do any other normal initialization of the factory.
* Subclasses that override {@link #createDefinition createDefinition()} should
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java
index 73a86c078ceb..519888bf2abe 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java
index 85e6b11a021e..7c4a159d5fa9 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java
@@ -2,7 +2,7 @@
/**
*
* Helper infrastructure to locate and access bean factories.
- *
+ *
* Note: This package is only relevant for special sharing of bean
* factories, for example behind EJB facades. It is not used in a
* typical web application or standalone application.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
index 4d0b8b5bbfbd..337a05b2b6a1 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
@@ -70,10 +70,10 @@
* if available, as a direct alternative to Spring's own @Autowired.
*
*
Only one constructor (at max) of any given bean class may carry this
- * annotation with the 'required' parameter set to true,
- * indicating the constructor to autowire when used as a Spring bean.
- * If multiple non-required constructors carry the annotation, they
- * will be considered as candidates for autowiring. The constructor with
+ * annotation with the 'required' parameter set to true,
+ * indicating the constructor to autowire when used as a Spring bean.
+ * If multiple non-required constructors carry the annotation, they
+ * will be considered as candidates for autowiring. The constructor with
* the greatest number of dependencies that can be satisfied by matching
* beans in the Spring container will be chosen. If none of the candidates
* can be satisfied, then a default constructor (if present) will be used.
@@ -109,9 +109,9 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
private final Set> autowiredAnnotationTypes =
new LinkedHashSet>();
-
+
private String requiredParameterName = "required";
-
+
private boolean requiredParameterValue = true;
private int order = Ordered.LOWEST_PRECEDENCE - 2;
@@ -185,9 +185,9 @@ public void setRequiredParameterName(String requiredParameterName) {
}
/**
- * Set the boolean value that marks a dependency as required
- * For example if using 'required=true' (the default),
- * this value should be true; but if using
+ * Set the boolean value that marks a dependency as required
+ *
For example if using 'required=true' (the default),
+ * this value should be true; but if using
* 'optional=false', this value should be false.
* @see #setRequiredParameterName(String)
*/
@@ -196,11 +196,11 @@ public void setRequiredParameterValue(boolean requiredParameterValue) {
}
public void setOrder(int order) {
- this.order = order;
+ this.order = order;
}
public int getOrder() {
- return this.order;
+ return this.order;
}
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java
index 040a80981ccd..84102e70e904 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java
@@ -25,7 +25,7 @@
/**
* Marks a class as being eligible for Spring-driven configuration.
- *
+ *
*
Typically used with the AspectJ AnnotationBeanConfigurerAspect.
*
* @author Rod Johnson
@@ -54,7 +54,7 @@
* Is dependency checking to be performed for configured objects?
*/
boolean dependencyCheck() default false;
-
+
/**
* Are dependencies to be injected prior to the construction of an object?
*/
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java
index 91bc3b5bfe36..0ba3e8742c66 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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();
@@ -77,7 +77,7 @@ public void setBeanClassLoader(ClassLoader beanClassLoader) {
* 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;
}
@@ -96,9 +96,9 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
QualifierAnnotationAutowireCandidateResolver resolver =
(QualifierAnnotationAutowireCandidateResolver) dlbf.getAutowireCandidateResolver();
for (Object value : this.customQualifierTypes) {
- Class customType = null;
+ Class> customType = null;
if (value instanceof Class) {
- customType = (Class) value;
+ customType = (Class>) value;
}
else if (value instanceof String) {
String className = (String) value;
@@ -112,7 +112,7 @@ else if (value instanceof String) {
throw new IllegalArgumentException(
"Qualifier type [" + customType.getName() + "] needs to be annotation type");
}
- resolver.addQualifierType(customType);
+ resolver.addQualifierType((Class extends Annotation>)customType);
}
}
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java
index 74a5e59d240d..e1ae64ca50e4 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java
@@ -109,14 +109,13 @@ public void setDestroyAnnotationType(Class extends Annotation> destroyAnnotati
}
public void setOrder(int order) {
- this.order = order;
+ this.order = order;
}
public int getOrder() {
- return this.order;
+ return this.order;
}
-
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class> beanType, String beanName) {
if (beanType != null) {
LifecycleMetadata metadata = findLifecycleMetadata(beanType);
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java
index fe3e3b15efd7..fb2a6c9213f0 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java
@@ -55,9 +55,19 @@ public class InjectionMetadata {
private volatile Set checkedElements;
- public InjectionMetadata(Class targetClass, Collection elements) {
- this.targetClass = targetClass;
- this.injectedElements = elements;
+ public InjectionMetadata(Class> targetClass, Collection elements) {
+ if (!elements.isEmpty()) {
+ this.injectedElements = Collections.synchronizedSet(new LinkedHashSet(elements.size()));
+ for (InjectedElement element : elements) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Found injected element on class [" + targetClass.getName() + "]: " + element);
+ }
+ this.injectedElements.add(element);
+ }
+ }
+ else {
+ this.injectedElements = Collections.emptySet();
+ }
}
public void checkConfigMembers(RootBeanDefinition beanDefinition) {
@@ -110,7 +120,7 @@ public final Member getMember() {
return this.member;
}
- protected final Class getResourceType() {
+ protected final Class> getResourceType() {
if (this.isField) {
return ((Field) this.member).getType();
}
@@ -122,16 +132,16 @@ else if (this.pd != null) {
}
}
- protected final void checkResourceType(Class resourceType) {
+ protected final void checkResourceType(Class> resourceType) {
if (this.isField) {
- Class fieldType = ((Field) this.member).getType();
+ Class> fieldType = ((Field) this.member).getType();
if (!(resourceType.isAssignableFrom(fieldType) || fieldType.isAssignableFrom(resourceType))) {
throw new IllegalStateException("Specified field type [" + fieldType +
"] is incompatible with resource type [" + resourceType.getName() + "]");
}
}
else {
- Class paramType =
+ Class> paramType =
(this.pd != null ? this.pd.getPropertyType() : ((Method) this.member).getParameterTypes()[0]);
if (!(resourceType.isAssignableFrom(paramType) || paramType.isAssignableFrom(resourceType))) {
throw new IllegalStateException("Specified parameter type [" + paramType +
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java
index 91aff60e6fda..46ef046864fd 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java
@@ -24,7 +24,7 @@
/**
* Marks a method (typically a JavaBean setter method) as being 'required': that is,
* the setter method must be configured to be dependency-injected with a value.
- *
+ *
* Please do consult the javadoc for the {@link RequiredAnnotationBeanPostProcessor}
* class (which, by default, checks for the presence of this annotation).
*
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
index e4db17e1eb50..ac79076d79ba 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
@@ -123,11 +123,11 @@ public void setBeanFactory(BeanFactory beanFactory) {
}
public void setOrder(int order) {
- this.order = order;
+ this.order = order;
}
public int getOrder() {
- return this.order;
+ return this.order;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java
index 67d52452787d..4ad3afbfb30e 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
* this class will create the object that it creates exactly once
* on initialization and subsequently return said singleton instance
* on all calls to the {@link #getObject()} method.
- *
+ *
*
Else, this class will create a new instance every time the
* {@link #getObject()} method is invoked. Subclasses are responsible
* for implementing the abstract {@link #createInstance()} template
@@ -153,7 +153,7 @@ public final T getObject() throws Exception {
*/
@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");
@@ -218,8 +218,8 @@ public void destroy() throws Exception {
* or null to indicate a FactoryBeanNotInitializedException
* @see org.springframework.beans.factory.FactoryBeanNotInitializedException
*/
- protected Class[] getEarlySingletonInterfaces() {
- Class type = getObjectType();
+ protected Class>[] getEarlySingletonInterfaces() {
+ Class> type = getObjectType();
return (type != null && type.isInterface() ? new Class[] {type} : null);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java
index 050ca889cae0..d15ecca5ee37 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -185,7 +185,7 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
* @see #AUTOWIRE_BY_TYPE
* @see #AUTOWIRE_CONSTRUCTOR
*/
- Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
+ T createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
/**
* Instantiate a new bean instance of the given class with the specified autowire
@@ -213,7 +213,7 @@ public interface AutowireCapableBeanFactory extends BeanFactory {
* @see #applyBeanPostProcessorsBeforeInitialization
* @see #applyBeanPostProcessorsAfterInitialization
*/
- Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
+ T autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;
/**
* Autowire the bean properties of the given bean instance by name or type.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java
index 1619505c1f52..47db66447eb6 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java
index 1a382a6324ea..cb979e8826f0 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,8 +45,7 @@
* @deprecated as of Spring 3.2, in favor of using regular bean name aliases
* (which support placeholder parsing since Spring 2.5)
*/
-@Deprecated
-public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAware {
+public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAware {
private String targetBeanName;
@@ -76,14 +75,15 @@ public void setBeanFactory(BeanFactory beanFactory) {
}
- public Object getObject() throws BeansException {
+ @SuppressWarnings("unchecked")
+ public T getObject() throws BeansException {
if (this.beanFactory == null) {
throw new FactoryBeanNotInitializedException();
}
- return this.beanFactory.getBean(this.targetBeanName);
+ return (T) this.beanFactory.getBean(this.targetBeanName);
}
- public Class getObjectType() {
+ public Class> getObjectType() {
if (this.beanFactory == null) {
return null;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java
index 70b2e00508b2..d0e93c8b0c83 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java
@@ -1,12 +1,12 @@
/*
- * Copyright 2002-2008 the original author or authors.
- *
+ * Copyright 2002-2012 the original author or authors.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java
index 3a3aa9df176c..174322f1c4d8 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -146,7 +146,7 @@ public boolean hasIndexedArgumentValue(int index) {
* untyped values only)
* @return the ValueHolder for the argument, or null if none set
*/
- public ValueHolder getIndexedArgumentValue(int index, Class requiredType) {
+ public ValueHolder getIndexedArgumentValue(int index, Class> requiredType) {
return getIndexedArgumentValue(index, requiredType, null);
}
@@ -159,7 +159,7 @@ public ValueHolder getIndexedArgumentValue(int index, Class requiredType) {
* unnamed values only)
* @return the ValueHolder for the argument, or null if none set
*/
- public ValueHolder getIndexedArgumentValue(int index, Class requiredType, String requiredName) {
+ public ValueHolder getIndexedArgumentValue(int index, Class> requiredType, String requiredName) {
Assert.isTrue(index >= 0, "Index must not be negative");
ValueHolder valueHolder = this.indexedArgumentValues.get(index);
if (valueHolder != null &&
@@ -247,7 +247,7 @@ private void addOrMergeGenericArgumentValue(ValueHolder newValue) {
* @param requiredType the type to match
* @return the ValueHolder for the argument, or null if none set
*/
- public ValueHolder getGenericArgumentValue(Class requiredType) {
+ public ValueHolder getGenericArgumentValue(Class> requiredType) {
return getGenericArgumentValue(requiredType, null, null);
}
@@ -257,7 +257,7 @@ public ValueHolder getGenericArgumentValue(Class requiredType) {
* @param requiredName the name to match
* @return the ValueHolder for the argument, or null if none set
*/
- public ValueHolder getGenericArgumentValue(Class requiredType, String requiredName) {
+ public ValueHolder getGenericArgumentValue(Class> requiredType, String requiredName) {
return getGenericArgumentValue(requiredType, requiredName, null);
}
@@ -273,7 +273,7 @@ public ValueHolder getGenericArgumentValue(Class requiredType, String requiredNa
* in the current resolution process and should therefore not be returned again
* @return the ValueHolder for the argument, or null if none found
*/
- public ValueHolder getGenericArgumentValue(Class requiredType, String requiredName, Set usedValueHolders) {
+ public ValueHolder getGenericArgumentValue(Class> requiredType, String requiredName, Set usedValueHolders) {
for (ValueHolder valueHolder : this.genericArgumentValues) {
if (usedValueHolders != null && usedValueHolders.contains(valueHolder)) {
continue;
@@ -312,7 +312,7 @@ public List getGenericArgumentValues() {
* @param requiredType the type to match
* @return the ValueHolder for the argument, or null if none set
*/
- public ValueHolder getArgumentValue(int index, Class requiredType) {
+ public ValueHolder getArgumentValue(int index, Class> requiredType) {
return getArgumentValue(index, requiredType, null, null);
}
@@ -324,7 +324,7 @@ public ValueHolder getArgumentValue(int index, Class requiredType) {
* @param requiredName the name to match
* @return the ValueHolder for the argument, or null if none set
*/
- public ValueHolder getArgumentValue(int index, Class requiredType, String requiredName) {
+ public ValueHolder getArgumentValue(int index, Class> requiredType, String requiredName) {
return getArgumentValue(index, requiredType, requiredName, null);
}
@@ -340,7 +340,7 @@ public ValueHolder getArgumentValue(int index, Class requiredType, String requir
* in case of multiple generic argument values of the same type)
* @return the ValueHolder for the argument, or null if none set
*/
- public ValueHolder getArgumentValue(int index, Class requiredType, String requiredName, Set usedValueHolders) {
+ public ValueHolder getArgumentValue(int index, Class> requiredType, String requiredName, Set usedValueHolders) {
Assert.isTrue(index >= 0, "Index must not be negative");
ValueHolder valueHolder = getIndexedArgumentValue(index, requiredType, requiredName);
if (valueHolder == null) {
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java
index 641f6c7f265d..6f758aae2eb9 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
/**
* {@link BeanFactoryPostProcessor} implementation that allows for convenient
* registration of custom {@link PropertyEditor property editors}.
- *
+ *
*
* In case you want to register {@link PropertyEditor} instances, the
* recommended usage as of Spring 2.0 is to use custom
@@ -43,7 +43,7 @@
* desired editor instances on a given
* {@link org.springframework.beans.PropertyEditorRegistry registry}. Each
* PropertyEditorRegistrar can register any number of custom editors.
- *
+ *
*
* <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
* <property name="propertyEditorRegistrars">
@@ -54,12 +54,12 @@
* </property>
* </bean>
*
- *
+ *
*
* It's perfectly fine to register {@link PropertyEditor} classes via
* the {@code customEditors} property. Spring will create fresh instances of
* them for each editing attempt then:
- *
+ *
*
* <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
* <property name="customEditors">
@@ -70,7 +70,7 @@
* </property>
* </bean>
*
- *
+ *
*
* Note, that you shouldn't register {@link PropertyEditor} bean instances via
* the {@code customEditors} property as {@link PropertyEditor}s are stateful
@@ -78,7 +78,7 @@
* attempt. In case you need control over the instantiation process of
* {@link PropertyEditor}s, use a {@link PropertyEditorRegistrar} to register
* them.
- *
+ *
*
* Also supports "java.lang.String[]"-style array class names and primitive
* class names (e.g. "boolean"). Delegates to {@link ClassUtils} for actual
@@ -116,11 +116,11 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla
public void setOrder(int order) {
- this.order = order;
+ this.order = order;
}
public int getOrder() {
- return this.order;
+ return this.order;
}
/**
@@ -178,7 +178,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
for (Map.Entry entry : this.customEditors.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
- Class requiredType = null;
+ Class> requiredType = null;
try {
requiredType = ClassUtils.forName(key, this.beanClassLoader);
@@ -192,10 +192,10 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
new SharedPropertyEditorRegistrar(requiredType, (PropertyEditor) value));
}
else if (value instanceof Class) {
- beanFactory.registerCustomEditor(requiredType, (Class) value);
+ beanFactory.registerCustomEditor(requiredType, (Class extends PropertyEditor>) value);
}
else if (value instanceof String) {
- Class editorClass = ClassUtils.forName((String) value, this.beanClassLoader);
+ Class> editorClass = ClassUtils.forName((String) value, this.beanClassLoader);
Assert.isAssignable(PropertyEditor.class, editorClass);
beanFactory.registerCustomEditor(requiredType, (Class extends PropertyEditor>) editorClass);
}
@@ -225,16 +225,17 @@ else if (value instanceof String) {
*/
private static class SharedPropertyEditorRegistrar implements PropertyEditorRegistrar {
- private final Class requiredType;
+ private final Class> requiredType;
private final PropertyEditor sharedEditor;
- public SharedPropertyEditorRegistrar(Class requiredType, PropertyEditor sharedEditor) {
+ public SharedPropertyEditorRegistrar(Class> requiredType, PropertyEditor sharedEditor) {
this.requiredType = requiredType;
this.sharedEditor = sharedEditor;
}
- public void registerCustomEditors(PropertyEditorRegistry registry) {
+ @SuppressWarnings("deprecation")
+ public void registerCustomEditors(PropertyEditorRegistry registry) {
if (!(registry instanceof PropertyEditorRegistrySupport)) {
throw new IllegalArgumentException("Cannot registered shared editor " +
"on non-PropertyEditorRegistrySupport registry: " + registry);
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java
index 130387e552a1..ec2bd5e4c4f5 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,8 +73,6 @@ public void setBeanClassLoader(ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
}
-
- @SuppressWarnings("unchecked")
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (this.scopes != null) {
for (Map.Entry entry : this.scopes.entrySet()) {
@@ -84,12 +82,12 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
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));
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
index ba38a85c4b7a..6af67a648d29 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
@@ -43,11 +43,11 @@ public class DependencyDescriptor implements Serializable {
private transient Field field;
- private Class declaringClass;
+ private Class> declaringClass;
private String methodName;
- private Class[] parameterTypes;
+ private Class>[] parameterTypes;
private int parameterIndex;
@@ -216,12 +216,12 @@ public Class> getDependencyType() {
if (type instanceof ParameterizedType) {
Type arg = ((ParameterizedType) type).getActualTypeArguments()[0];
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;
}
}
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java
index 7b3c5ea5df29..7aa79855ed45 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
/**
* {@link FactoryBean} which retrieves a static or non-static field value.
- *
+ *
* Typically used for retrieving public static final constants. Usage example:
*
*
// standard definition for exposing a static field, specifying the "staticField" property
@@ -42,10 +42,10 @@
* <bean id="java.sql.Connection.TRANSACTION_SERIALIZABLE"
* class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
*
- *
+ *
* If you are using Spring 2.0, you can also use the following style of configuration for
* public static fields.
- *
+ *
*
<util:constant static-field="java.sql.Connection.TRANSACTION_SERIALIZABLE"/>
*
* @author Juergen Hoeller
@@ -55,7 +55,7 @@
public class FieldRetrievingFactoryBean
implements FactoryBean, 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;
}
@@ -186,11 +186,10 @@ else if (this.targetField == null) {
}
// 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);
}
-
public Object getObject() throws IllegalAccessException {
if (this.fieldObject == null) {
throw new FactoryBeanNotInitializedException();
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java
index 7ceb21f7535f..870e9b76542a 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,17 +32,17 @@
* @see SetFactoryBean
* @see MapFactoryBean
*/
-public class ListFactoryBean extends AbstractFactoryBean {
+public class ListFactoryBean extends AbstractFactoryBean> {
- private List sourceList;
+ private List> sourceList;
- private Class targetListClass;
+ 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,36 +52,38 @@ public void setSourceList(List sourceList) {
* Default is a java.util.ArrayList.
* @see java.util.ArrayList
*/
- public void setTargetListClass(Class targetListClass) {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void setTargetListClass(Class extends List> targetListClass) {
if (targetListClass == null) {
throw new IllegalArgumentException("'targetListClass' must not be null");
}
if (!List.class.isAssignableFrom(targetListClass)) {
throw new IllegalArgumentException("'targetListClass' must implement [java.util.List]");
}
- this.targetListClass = targetListClass;
+ this.targetListClass = (Class extends List>>) targetListClass;
}
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return List.class;
}
@Override
@SuppressWarnings("unchecked")
- protected List createInstance() {
+ protected List> createInstance() {
if (this.sourceList == null) {
throw new IllegalArgumentException("'sourceList' is required");
}
+ @SuppressWarnings("rawtypes")
List 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(this.sourceList.size());
}
- Class valueType = null;
+ Class> valueType = null;
if (this.targetListClass != null) {
valueType = GenericCollectionTypeResolver.getCollectionType(this.targetListClass);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java
index 436e20da9359..7e6772ccb01c 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,17 +32,17 @@
* @see SetFactoryBean
* @see ListFactoryBean
*/
-public class MapFactoryBean extends AbstractFactoryBean {
+public class MapFactoryBean extends AbstractFactoryBean> {
private Map, ?> sourceMap;
- private Class targetMapClass;
+ 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,44 +52,45 @@ public void setSourceMap(Map sourceMap) {
* Default is a linked HashMap, keeping the registration order.
* @see java.util.LinkedHashMap
*/
- public void setTargetMapClass(Class targetMapClass) {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void setTargetMapClass(Class extends Map> targetMapClass) {
if (targetMapClass == null) {
throw new IllegalArgumentException("'targetMapClass' must not be null");
}
if (!Map.class.isAssignableFrom(targetMapClass)) {
throw new IllegalArgumentException("'targetMapClass' must implement [java.util.Map]");
}
- this.targetMapClass = targetMapClass;
+ this.targetMapClass = (Class extends Map, ?>>) targetMapClass;
}
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return Map.class;
}
@Override
- @SuppressWarnings("unchecked")
- protected Map createInstance() {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected Map, ?> createInstance() {
if (this.sourceMap == null) {
throw new IllegalArgumentException("'sourceMap' is required");
}
Map result = null;
if (this.targetMapClass != null) {
- result = (Map) BeanUtils.instantiateClass(this.targetMapClass);
+ result = BeanUtils.instantiateClass(this.targetMapClass);
}
else {
result = new LinkedHashMap(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);
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java
index 51440d47dadc..e8188ae2d170 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
/**
* {@link FactoryBean} which returns a value which is the result of a static or instance
- * method invocation. For most use cases it is better to just use the container's
+ * method invocation. For most use cases it is better to just use the container's
* built-in factory method support for the same purpose, since that is smarter at
* converting arguments. This factory bean is still useful though when you need to
* call a method which doesn't return any value (for example, a static class method
@@ -55,7 +55,7 @@
*
* This class depends on {@link #afterPropertiesSet()} being called once
* all properties have been set, as per the InitializingBean contract.
- *
+ *
*
An example (in an XML based bean factory definition) of a bean definition
* which uses this class to call a static factory method:
*
@@ -82,7 +82,7 @@
* </list>
* </property>
* </bean>
- *
+ *
* @author Colin Sampaleanu
* @author Juergen Hoeller
* @since 21.11.2003
@@ -119,7 +119,7 @@ public void setBeanClassLoader(ClassLoader classLoader) {
}
@Override
- protected Class resolveClassName(String className) throws ClassNotFoundException {
+ protected Class> resolveClassName(String className) throws ClassNotFoundException {
return ClassUtils.forName(className, this.beanClassLoader);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java
index d2fc8ab2591e..92e417d0759c 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java
@@ -94,7 +94,7 @@
* @see org.springframework.beans.factory.ObjectFactory
* @see ServiceLocatorFactoryBean
*/
-public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean {
+public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean> {
private String targetBeanName;
@@ -118,12 +118,12 @@ public void afterPropertiesSet() throws Exception {
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return ObjectFactory.class;
}
@Override
- protected ObjectFactory createInstance() {
+ protected ObjectFactory createInstance() {
return new TargetBeanObjectFactory(getBeanFactory(), this.targetBeanName);
}
@@ -131,7 +131,7 @@ protected ObjectFactory createInstance() {
/**
* Independent inner class - for serialization purposes.
*/
- private static class TargetBeanObjectFactory implements ObjectFactory, Serializable {
+ private static class TargetBeanObjectFactory implements ObjectFactory, Serializable {
private final BeanFactory beanFactory;
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java
index f025a941c1d4..612fbdca1979 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,9 +76,9 @@ public void setUserTreePath(String userTreePath) {
*/
public void afterPropertiesSet() {
this.systemPrefs = (this.systemTreePath != null) ?
- Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot();
+ Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot();
this.userPrefs = (this.userTreePath != null) ?
- Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot();
+ Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot();
}
/**
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java
index 736a7d14fd5e..a9da82207da5 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java
@@ -100,7 +100,7 @@ public void setIgnoreInvalidKeys(boolean ignoreInvalidKeys) {
protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
throws BeansException {
- for (Enumeration names = props.propertyNames(); names.hasMoreElements();) {
+ for (Enumeration> names = props.propertyNames(); names.hasMoreElements();) {
String key = (String) names.nextElement();
try {
processKey(beanFactory, key, props.getProperty(key));
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java
index 518ce93ff3b0..4015827ae7c7 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
/**
* {@link FactoryBean} that evaluates a property path on a given target object.
- *
+ *
* The target object can be specified directly or via a bean name.
*
*
Usage examples:
@@ -64,12 +64,12 @@
*
* <!-- will result in 10, which is the value of property 'age' of bean 'tb' -->
* <bean id="tb.age" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
- *
+ *
*
If you are using Spring 2.0 and XML Schema support in your configuration file(s),
* you can also use the following style of configuration for property path access.
* (See also the appendix entitled 'XML Schema-based configuration' in the Spring
* reference manual for more examples.)
- *
+ *
*
<!-- will result in 10, which is the value of property 'age' of bean 'tb' -->
* <util:property-path id="name" path="testBean.age"/>
*
@@ -91,7 +91,7 @@ public class PropertyPathFactoryBean implements FactoryBean, BeanNameAwa
private String propertyPath;
- private Class resultType;
+ private Class> resultType;
private String beanName;
@@ -137,7 +137,7 @@ public void setPropertyPath(String propertyPath) {
* provided that you need matching by type (for example, for autowiring).
* @param resultType the result type, for example "java.lang.Integer"
*/
- public void setResultType(Class resultType) {
+ public void setResultType(Class> resultType) {
this.resultType = resultType;
}
@@ -162,15 +162,15 @@ public void setBeanFactory(BeanFactory beanFactory) {
if (this.targetBeanWrapper == null && this.targetBeanName == null) {
if (this.propertyPath != null) {
throw new IllegalArgumentException(
- "Specify 'targetObject' or 'targetBeanName' in combination with 'propertyPath'");
+ "Specify 'targetObject' or 'targetBeanName' in combination with 'propertyPath'");
}
// No other properties specified: check bean name.
int dotIndex = this.beanName.indexOf('.');
if (dotIndex == -1) {
throw new IllegalArgumentException(
- "Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " +
- "bean name '" + this.beanName + "' does not follow 'beanName.property' syntax");
+ "Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " +
+ "bean name '" + this.beanName + "' does not follow 'beanName.property' syntax");
}
this.targetBeanName = this.beanName.substring(0, dotIndex);
this.propertyPath = this.beanName.substring(dotIndex + 1);
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java
index 317defbe96fa..6d7024a33955 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java
@@ -39,7 +39,7 @@
* @see javax.inject.Provider
* @see ObjectFactoryCreatingFactoryBean
*/
-public class ProviderCreatingFactoryBean extends AbstractFactoryBean {
+public class ProviderCreatingFactoryBean extends AbstractFactoryBean> {
private String targetBeanName;
@@ -63,20 +63,20 @@ public void afterPropertiesSet() throws Exception {
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return Provider.class;
}
@Override
- protected Provider createInstance() {
- return new TargetBeanProvider(getBeanFactory(), this.targetBeanName);
+ protected Provider createInstance() {
+ return new TargetBeanProvider(getBeanFactory(), this.targetBeanName);
}
/**
* Independent inner class - for serialization purposes.
*/
- private static class TargetBeanProvider implements Provider, Serializable {
+ private static class TargetBeanProvider implements Provider, Serializable {
private final BeanFactory beanFactory;
@@ -87,8 +87,9 @@ public TargetBeanProvider(BeanFactory beanFactory, String targetBeanName) {
this.targetBeanName = targetBeanName;
}
- public Object get() throws BeansException {
- return this.beanFactory.getBean(this.targetBeanName);
+ @SuppressWarnings("unchecked")
+ public T get() throws BeansException {
+ return (T) this.beanFactory.getBean(this.targetBeanName);
}
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java
index 3df4a47c2714..1babf96e52d2 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
import org.springframework.util.Assert;
-/**
+/**
* Immutable placeholder class used for a property value object when it's a
* reference to another bean name in the factory, to be resolved at runtime.
*
@@ -29,7 +29,7 @@
* @see org.springframework.beans.factory.BeanFactory#getBean
*/
public class RuntimeBeanNameReference implements BeanReference {
-
+
private final String beanName;
private Object source;
@@ -80,7 +80,7 @@ public int hashCode() {
@Override
public String toString() {
- return '<' + getBeanName() + '>';
+ return '<' + getBeanName() + '>';
}
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java
index 822d98c43cc2..4ebe01801f3a 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
import org.springframework.util.Assert;
-/**
+/**
* Immutable placeholder class used for a property value object when it's
* a reference to another bean in the factory, to be resolved at runtime.
*
@@ -28,7 +28,7 @@
* @see org.springframework.beans.factory.BeanFactory#getBean
*/
public class RuntimeBeanReference implements BeanReference {
-
+
private final String beanName;
private final boolean toParent;
@@ -107,7 +107,7 @@ public int hashCode() {
@Override
public String toString() {
- return '<' + getBeanName() + '>';
+ return '<' + getBeanName() + '>';
}
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java
index 192f6b7e6678..e172a0a7fab5 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -187,17 +187,17 @@
* @see #setServiceMappings
* @see ObjectFactoryCreatingFactoryBean
*/
-public class ServiceLocatorFactoryBean implements FactoryBean, BeanFactoryAware, InitializingBean {
+public class ServiceLocatorFactoryBean implements FactoryBean, BeanFactoryAware, InitializingBean {
- private Class serviceLocatorInterface;
+ private Class> serviceLocatorInterface;
- private Constructor serviceLocatorExceptionConstructor;
+ private Constructor extends Exception> serviceLocatorExceptionConstructor;
private Properties serviceMappings;
private ListableBeanFactory beanFactory;
- private Object proxy;
+ private T proxy;
/**
@@ -207,7 +207,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean, BeanFacto
* See the {@link ServiceLocatorFactoryBean class-level Javadoc} for
* information on the semantics of such methods.
*/
- public void setServiceLocatorInterface(Class interfaceType) {
+ public void setServiceLocatorInterface(Class> interfaceType) {
this.serviceLocatorInterface = interfaceType;
}
@@ -223,7 +223,7 @@ public void setServiceLocatorInterface(Class interfaceType) {
* @see #determineServiceLocatorExceptionConstructor
* @see #createServiceLocatorException
*/
- public void setServiceLocatorExceptionClass(Class serviceLocatorExceptionClass) {
+ public void setServiceLocatorExceptionClass(Class serviceLocatorExceptionClass) {
if (serviceLocatorExceptionClass != null && !Exception.class.isAssignableFrom(serviceLocatorExceptionClass)) {
throw new IllegalArgumentException(
"serviceLocatorException [" + serviceLocatorExceptionClass.getName() + "] is not a subclass of Exception");
@@ -254,13 +254,14 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = (ListableBeanFactory) beanFactory;
}
+ @SuppressWarnings("unchecked")
public void afterPropertiesSet() {
if (this.serviceLocatorInterface == null) {
throw new IllegalArgumentException("Property 'serviceLocatorInterface' is required");
}
// Create service locator proxy.
- this.proxy = Proxy.newProxyInstance(
+ this.proxy = (T)Proxy.newProxyInstance(
this.serviceLocatorInterface.getClassLoader(),
new Class[] {this.serviceLocatorInterface},
new ServiceLocatorInvocationHandler());
@@ -277,7 +278,7 @@ public void afterPropertiesSet() {
* @return the constructor to use
* @see #setServiceLocatorExceptionClass
*/
- protected Constructor determineServiceLocatorExceptionConstructor(Class exceptionClass) {
+ protected Constructor determineServiceLocatorExceptionConstructor(Class exceptionClass) {
try {
return exceptionClass.getConstructor(new Class[] {String.class, Throwable.class});
}
@@ -308,8 +309,8 @@ protected Constructor determineServiceLocatorExceptionConstructor(Class exceptio
* @return the service locator exception to throw
* @see #setServiceLocatorExceptionClass
*/
- protected Exception createServiceLocatorException(Constructor exceptionConstructor, BeansException cause) {
- Class[] paramTypes = exceptionConstructor.getParameterTypes();
+ protected E createServiceLocatorException(Constructor exceptionConstructor, BeansException cause) {
+ Class>[] paramTypes = exceptionConstructor.getParameterTypes();
Object[] args = new Object[paramTypes.length];
for (int i = 0; i < paramTypes.length; i++) {
if (paramTypes[i].equals(String.class)) {
@@ -319,11 +320,11 @@ else if (paramTypes[i].isInstance(cause)) {
args[i] = cause;
}
}
- return (Exception) BeanUtils.instantiateClass(exceptionConstructor, args);
+ return BeanUtils.instantiateClass(exceptionConstructor, args);
}
- public Object getObject() {
+ public T getObject() {
return this.proxy;
}
@@ -358,9 +359,8 @@ else if (ReflectionUtils.isToStringMethod(method)) {
}
}
- @SuppressWarnings("unchecked")
private Object invokeServiceLocatorMethod(Method method, Object[] args) throws Exception {
- Class serviceLocatorMethodReturnType = getServiceLocatorMethodReturnType(method);
+ Class> serviceLocatorMethodReturnType = getServiceLocatorMethodReturnType(method);
try {
String beanName = tryGetBeanName(args);
if (StringUtils.hasLength(beanName)) {
@@ -398,10 +398,10 @@ private String tryGetBeanName(Object[] args) {
return beanName;
}
- private Class getServiceLocatorMethodReturnType(Method method) throws NoSuchMethodException {
- Class[] paramTypes = method.getParameterTypes();
+ private Class> getServiceLocatorMethodReturnType(Method method) throws NoSuchMethodException {
+ Class>[] paramTypes = method.getParameterTypes();
Method interfaceMethod = serviceLocatorInterface.getMethod(method.getName(), paramTypes);
- Class serviceLocatorReturnType = interfaceMethod.getReturnType();
+ Class> serviceLocatorReturnType = interfaceMethod.getReturnType();
// Check whether the method is a valid service locator.
if (paramTypes.length > 1 || void.class.equals(serviceLocatorReturnType)) {
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java
index e3b2ee9e21e5..7dfd0983a475 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,17 +32,17 @@
* @see ListFactoryBean
* @see MapFactoryBean
*/
-public class SetFactoryBean extends AbstractFactoryBean {
+public class SetFactoryBean extends AbstractFactoryBean> {
- private Set sourceSet;
+ private Set> sourceSet;
- private Class targetSetClass;
+ private Class extends Set>> targetSetClass;
/**
* Set the source Set, typically populated via XML "set" elements.
*/
- public void setSourceSet(Set sourceSet) {
+ public void setSourceSet(Set> sourceSet) {
this.sourceSet = sourceSet;
}
@@ -52,36 +52,38 @@ public void setSourceSet(Set sourceSet) {
* Default is a linked HashSet, keeping the registration order.
* @see java.util.LinkedHashSet
*/
- public void setTargetSetClass(Class targetSetClass) {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void setTargetSetClass(Class extends Set> targetSetClass) {
if (targetSetClass == null) {
throw new IllegalArgumentException("'targetSetClass' must not be null");
}
if (!Set.class.isAssignableFrom(targetSetClass)) {
throw new IllegalArgumentException("'targetSetClass' must implement [java.util.Set]");
}
- this.targetSetClass = targetSetClass;
+ this.targetSetClass = (Class extends Set>>) targetSetClass;
}
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return Set.class;
}
@Override
- @SuppressWarnings("unchecked")
- protected Set createInstance() {
+ @SuppressWarnings({ "unchecked", "cast" })
+ protected Set> createInstance() {
if (this.sourceSet == null) {
throw new IllegalArgumentException("'sourceSet' is required");
}
+ @SuppressWarnings("rawtypes")
Set result = null;
if (this.targetSetClass != null) {
- result = (Set) BeanUtils.instantiateClass(this.targetSetClass);
+ result = (Set>) BeanUtils.instantiateClass(this.targetSetClass);
}
else {
- result = new LinkedHashSet(this.sourceSet.size());
+ result = new LinkedHashSet(this.sourceSet.size());
}
- Class valueType = null;
+ Class> valueType = null;
if (this.targetSetClass != null) {
valueType = GenericCollectionTypeResolver.getCollectionType(this.targetSetClass);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java
index 01e7cb52e2fb..cedbedaf9b4c 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ public TypedStringValue(String value) {
* @param value the String value
* @param targetType the type to convert to
*/
- public TypedStringValue(String value, Class targetType) {
+ public TypedStringValue(String value, Class> targetType) {
setValue(value);
setTargetType(targetType);
}
@@ -101,7 +101,7 @@ public String getValue() {
* for example in BeanFactoryPostProcessors.
* @see PropertyPlaceholderConfigurer
*/
- public void setTargetType(Class targetType) {
+ public void setTargetType(Class> targetType) {
Assert.notNull(targetType, "'targetType' must not be null");
this.targetType = targetType;
}
@@ -109,12 +109,12 @@ public void setTargetType(Class targetType) {
/**
* Return the type to convert to.
*/
- public Class getTargetType() {
+ public Class> getTargetType() {
Object targetTypeValue = this.targetType;
if (!(targetTypeValue instanceof Class)) {
throw new IllegalStateException("Typed String value does not carry a resolved target type");
}
- return (Class) targetTypeValue;
+ return (Class>) targetTypeValue;
}
/**
@@ -131,7 +131,7 @@ public void setTargetTypeName(String targetTypeName) {
public String getTargetTypeName() {
Object targetTypeValue = this.targetType;
if (targetTypeValue instanceof Class) {
- return ((Class) targetTypeValue).getName();
+ return ((Class>) targetTypeValue).getName();
}
else {
return (String) targetTypeValue;
@@ -153,11 +153,11 @@ public boolean hasTargetType() {
* @return the resolved type to convert to
* @throws ClassNotFoundException if the type cannot be resolved
*/
- public Class resolveTargetType(ClassLoader classLoader) throws ClassNotFoundException {
+ public Class> resolveTargetType(ClassLoader classLoader) throws ClassNotFoundException {
if (this.targetType == null) {
return null;
}
- Class resolvedClass = ClassUtils.forName(getTargetTypeName(), classLoader);
+ Class> resolvedClass = ClassUtils.forName(getTargetTypeName(), classLoader);
this.targetType = resolvedClass;
return resolvedClass;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java b/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java
index bae3c67c50e9..d4454c46ee6d 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java
@@ -6,7 +6,7 @@
* Provides an alternative to the Singleton and Prototype design
* patterns, including a consistent approach to configuration management.
* Builds on the org.springframework.beans package.
- *
+ *
* This package and related packages are discussed in Chapter 11 of
* Expert One-On-One J2EE Design and Development
* by Rod Johnson (Wrox, 2002).
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java
index 9b3311f51276..97ce2d3dde20 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java
@@ -22,7 +22,7 @@
/**
* Simple {@link ProblemReporter} implementation that exhibits fail-fast
* behavior when errors are encountered.
- *
+ *
*
The first error encountered results in a {@link BeanDefinitionParsingException}
* being thrown.
*
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java
index 7ef3254da7f1..969e4c449dac 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,22 +40,23 @@ public final class ParseState {
/**
* Internal {@link Stack} storage.
*/
- private final Stack state;
+ private final Stack state;
/**
* Create a new ParseState with an empty {@link Stack}.
*/
public ParseState() {
- this.state = new Stack();
+ this.state = new Stack();
}
/**
* Create a new ParseState whose {@link Stack} is a {@link Object#clone clone}
* of that of the passed in ParseState.
*/
- private ParseState(ParseState other) {
- this.state = (Stack) other.state.clone();
+ @SuppressWarnings("unchecked")
+ private ParseState(ParseState other) {
+ this.state = (Stack) other.state.clone();
}
@@ -78,7 +79,7 @@ public void pop() {
* null if the {@link Stack} is empty.
*/
public Entry peek() {
- return (Entry) (this.state.empty() ? null : this.state.peek());
+ return (this.state.empty() ? null : this.state.peek());
}
/**
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java
index c1737e456ca5..18875d3af35f 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java
@@ -33,7 +33,7 @@ public class PropertyEntry implements ParseState.Entry {
* Creates a new instance of the {@link PropertyEntry} class.
* @param name the name of the JavaBean property represented by this instance
* @throws IllegalArgumentException if the supplied name is null
- * or consists wholly of whitespace
+ * or consists wholly of whitespace
*/
public PropertyEntry(String name) {
if (!StringUtils.hasText(name)) {
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java
index 2c80092fb15d..4da479b2341b 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java
@@ -20,7 +20,7 @@
/**
* {@link ParseState} entry representing an autowire candidate qualifier.
- *
+ *
* @author Mark Fisher
* @since 2.5
*/
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java
index 27e72ce9e077..06b73d01147e 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,10 +31,10 @@
* @since 2.5
* @see java.util.ServiceLoader
*/
-public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFactoryBean
+public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFactoryBean
implements BeanClassLoaderAware {
- private Class serviceType;
+ private Class serviceType;
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
@@ -42,14 +42,14 @@ public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFact
/**
* Specify the desired service type (typically the service's public API).
*/
- public void setServiceType(Class serviceType) {
+ public void setServiceType(Class serviceType) {
this.serviceType = serviceType;
}
/**
* Return the desired service type.
*/
- public Class getServiceType() {
+ public Class getServiceType() {
return this.serviceType;
}
@@ -64,7 +64,7 @@ public void setBeanClassLoader(ClassLoader beanClassLoader) {
* @return the object to expose
*/
@Override
- protected Object createInstance() {
+ protected T createInstance() {
Assert.notNull(getServiceType(), "Property 'serviceType' is required");
return getObjectToExpose(ServiceLoader.load(getServiceType(), this.beanClassLoader));
}
@@ -75,6 +75,6 @@ protected Object createInstance() {
* @param serviceLoader the ServiceLoader for the configured service class
* @return the object to expose
*/
- protected abstract Object getObjectToExpose(ServiceLoader serviceLoader);
+ protected abstract T getObjectToExpose(ServiceLoader serviceLoader);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java
index 5abbda9f2bc5..d79c6380a909 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,11 +30,11 @@
* @since 2.5
* @see java.util.ServiceLoader
*/
-public class ServiceFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware {
+public class ServiceFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware {
@Override
- protected Object getObjectToExpose(ServiceLoader serviceLoader) {
- Iterator it = serviceLoader.iterator();
+ protected T getObjectToExpose(ServiceLoader serviceLoader) {
+ Iterator it = serviceLoader.iterator();
if (!it.hasNext()) {
throw new IllegalStateException(
"ServiceLoader could not find service for type [" + getServiceType() + "]");
@@ -43,7 +43,7 @@ protected Object getObjectToExpose(ServiceLoader serviceLoader) {
}
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return getServiceType();
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java
index b23cd70ee0e1..4c4f3ecebaf1 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,19 +31,19 @@
* @since 2.5
* @see java.util.ServiceLoader
*/
-public class ServiceListFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware {
+public class ServiceListFactoryBean extends AbstractServiceLoaderBasedFactoryBean, T> implements BeanClassLoaderAware {
@Override
- protected Object getObjectToExpose(ServiceLoader serviceLoader) {
- List result = new LinkedList();
- for (Object loaderObject : serviceLoader) {
+ protected List getObjectToExpose(ServiceLoader serviceLoader) {
+ List result = new LinkedList();
+ for (T loaderObject : serviceLoader) {
result.add(loaderObject);
}
return result;
}
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return List.class;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java
index 34f3a1cf21cc..584f8c495363 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,15 +28,15 @@
* @since 2.5
* @see java.util.ServiceLoader
*/
-public class ServiceLoaderFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware {
+public class ServiceLoaderFactoryBean extends AbstractServiceLoaderBasedFactoryBean, S> implements BeanClassLoaderAware {
@Override
- protected Object getObjectToExpose(ServiceLoader serviceLoader) {
+ protected ServiceLoader getObjectToExpose(ServiceLoader serviceLoader) {
return serviceLoader;
}
@Override
- public Class getObjectType() {
+ public Class> getObjectType() {
return ServiceLoader.class;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
index 1cf82fc69047..7daa3b6329ef 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
@@ -135,21 +135,21 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
* Dependency types to ignore on dependency check and autowire, as Set of
* Class objects: for example, String. Default is none.
*/
- private final Set ignoredDependencyTypes = new HashSet();
+ private final Set> ignoredDependencyTypes = new HashSet>();
/**
* Dependency interfaces to ignore on dependency check and autowire, as Set of
* Class objects. By default, only the BeanFactory interface is ignored.
*/
- private final Set ignoredDependencyInterfaces = new HashSet();
+ private final Set> ignoredDependencyInterfaces = new HashSet>();
/** Cache of unfinished FactoryBean instances: FactoryBean name --> BeanWrapper */
private final Map factoryBeanInstanceCache =
new ConcurrentHashMap(16);
/** Cache of filtered PropertyDescriptors: bean Class -> PropertyDescriptor array */
- private final Map filteredPropertyDescriptorsCache =
- new ConcurrentHashMap(64);
+ private final Map, PropertyDescriptor[]> filteredPropertyDescriptorsCache =
+ new ConcurrentHashMap, PropertyDescriptor[]>();
/**
@@ -243,7 +243,7 @@ public void setAllowRawInjectionDespiteWrapping(boolean allowRawInjectionDespite
* Ignore the given dependency type for autowiring:
* for example, String. Default is none.
*/
- public void ignoreDependencyType(Class type) {
+ public void ignoreDependencyType(Class> type) {
this.ignoredDependencyTypes.add(type);
}
@@ -257,7 +257,7 @@ public void ignoreDependencyType(Class type) {
* @see org.springframework.beans.factory.BeanFactoryAware
* @see org.springframework.context.ApplicationContextAware
*/
- public void ignoreDependencyInterface(Class ifc) {
+ public void ignoreDependencyInterface(Class> ifc) {
this.ignoredDependencyInterfaces.add(ifc);
}
@@ -329,36 +329,38 @@ public Object resolveDependency(DependencyDescriptor descriptor, String beanName
// Specialized methods for fine-grained control over the bean lifecycle
//-------------------------------------------------------------------------
- public Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
+ @SuppressWarnings("unchecked")
+ public T createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
- return createBean(beanClass.getName(), bd, null);
+ return (T) createBean(beanClass.getName(), bd, null);
}
- public Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
+ @SuppressWarnings("unchecked")
+ public T autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
final RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
if (bd.getResolvedAutowireMode() == AUTOWIRE_CONSTRUCTOR) {
- return autowireConstructor(beanClass.getName(), bd, null, null).getWrappedInstance();
+ return (T) autowireConstructor(beanClass.getName(), bd, null, null).getWrappedInstance();
}
else {
- Object bean;
+ T bean;
final BeanFactory parent = this;
-
+
if (System.getSecurityManager() != null) {
- bean = AccessController.doPrivileged(new PrivilegedAction() {
-
- public Object run() {
- return getInstantiationStrategy().instantiate(bd, null, parent);
+ bean = AccessController.doPrivileged(new PrivilegedAction() {
+
+ public T run() {
+ return (T) getInstantiationStrategy().instantiate(bd, null, parent);
}
}, getAccessControlContext());
}
else {
- bean = getInstantiationStrategy().instantiate(bd, null, parent);
+ bean = (T) getInstantiationStrategy().instantiate(bd, null, parent);
}
-
+
populateBean(beanClass.getName(), bd, new BeanWrapperImpl(bean));
return bean;
}
@@ -490,7 +492,7 @@ protected Object doCreateBean(final String beanName, final RootBeanDefinition mb
instanceWrapper = createBeanInstance(beanName, mbd, args);
}
final Object bean = (instanceWrapper != null ? instanceWrapper.getWrappedInstance() : null);
- Class beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null);
+ Class> beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null);
// Allow post-processors to modify the merged bean definition.
synchronized (mbd.postProcessingLock) {
@@ -509,7 +511,7 @@ protected Object doCreateBean(final String beanName, final RootBeanDefinition mb
logger.debug("Eagerly caching bean '" + beanName +
"' to allow for resolving potential circular references");
}
- addSingletonFactory(beanName, new ObjectFactory() {
+ addSingletonFactory(beanName, new ObjectFactory() {
public Object getObject() throws BeansException {
return getEarlyBeanReference(beanName, mbd, bean);
}
@@ -572,8 +574,8 @@ else if (!this.allowRawInjectionDespiteWrapping && hasDependentBean(beanName)) {
}
@Override
- protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class... typesToMatch) {
- Class beanClass;
+ protected Class> predictBeanType(String beanName, RootBeanDefinition mbd, Class>... typesToMatch) {
+ Class> beanClass;
if (mbd.getFactoryMethodName() != null) {
beanClass = getTypeForFactoryMethod(beanName, mbd, typesToMatch);
}
@@ -586,7 +588,7 @@ protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class..
for (BeanPostProcessor bp : getBeanPostProcessors()) {
if (bp instanceof SmartInstantiationAwareBeanPostProcessor) {
SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp;
- Class processedType = ibp.predictBeanType(beanClass, beanName);
+ Class> processedType = ibp.predictBeanType(beanClass, beanName);
if (processedType != null) {
return processedType;
}
@@ -610,8 +612,8 @@ protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class..
* @return the type for the bean if determinable, or null else
* @see #createBean
*/
- protected Class getTypeForFactoryMethod(String beanName, RootBeanDefinition mbd, Class[] typesToMatch) {
- Class factoryClass;
+ protected Class> getTypeForFactoryMethod(String beanName, RootBeanDefinition mbd, Class>[] typesToMatch) {
+ Class> factoryClass;
boolean isStatic = true;
String factoryBeanName = mbd.getFactoryBeanName();
@@ -762,11 +764,11 @@ protected Object getEarlyBeanReference(String beanName, RootBeanDefinition mbd,
* @return the FactoryBean instance, or null to indicate
* that we couldn't obtain a shortcut FactoryBean instance
*/
- private FactoryBean getSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) {
+ private FactoryBean> getSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) {
synchronized (getSingletonMutex()) {
BeanWrapper bw = this.factoryBeanInstanceCache.get(beanName);
if (bw != null) {
- return (FactoryBean) bw.getWrappedInstance();
+ return (FactoryBean>) bw.getWrappedInstance();
}
if (isSingletonCurrentlyInCreation(beanName)) {
return null;
@@ -786,7 +788,7 @@ private FactoryBean getSingletonFactoryBeanForTypeCheck(String beanName, RootBea
// Finished partial creation of this bean.
afterSingletonCreation(beanName);
}
- FactoryBean fb = getFactoryBean(beanName, instance);
+ FactoryBean> fb = getFactoryBean(beanName, instance);
if (bw != null) {
this.factoryBeanInstanceCache.put(beanName, bw);
}
@@ -803,7 +805,7 @@ private FactoryBean getSingletonFactoryBeanForTypeCheck(String beanName, RootBea
* @return the FactoryBean instance, or null to indicate
* that we couldn't obtain a shortcut FactoryBean instance
*/
- private FactoryBean getNonSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) {
+ private FactoryBean> getNonSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) {
if (isPrototypeCurrentlyInCreation(beanName)) {
return null;
}
@@ -834,7 +836,7 @@ private FactoryBean getNonSingletonFactoryBeanForTypeCheck(String beanName, Root
* @throws BeansException if any post-processing failed
* @see MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition
*/
- protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class beanType, String beanName)
+ protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class> beanType, String beanName)
throws BeansException {
try {
@@ -885,7 +887,7 @@ protected Object resolveBeforeInstantiation(String beanName, RootBeanDefinition
* @throws BeansException if any post-processing failed
* @see InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation
*/
- protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, String beanName)
+ protected Object applyBeanPostProcessorsBeforeInstantiation(Class> beanClass, String beanName)
throws BeansException {
for (BeanPostProcessor bp : getBeanPostProcessors()) {
@@ -914,14 +916,14 @@ protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, Str
*/
protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd, Object[] args) {
// Make sure bean class is actually resolved at this point.
- Class beanClass = resolveBeanClass(mbd, beanName);
+ Class> beanClass = resolveBeanClass(mbd, beanName);
if (beanClass != null && !Modifier.isPublic(beanClass.getModifiers()) && !mbd.isNonPublicAccessAllowed()) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Bean class isn't public, and non-public access not allowed: " + beanClass.getName());
}
- if (mbd.getFactoryMethodName() != null) {
+ if (mbd.getFactoryMethodName() != null) {
return instantiateUsingFactoryMethod(beanName, mbd, args);
}
@@ -946,10 +948,10 @@ protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd
}
// Need to determine the constructor...
- Constructor[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName);
+ Constructor>[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName);
if (ctors != null ||
mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR ||
- mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) {
+ mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) {
return autowireConstructor(beanName, mbd, ctors, args);
}
@@ -966,14 +968,14 @@ protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd
* @throws org.springframework.beans.BeansException in case of errors
* @see org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor#determineCandidateConstructors
*/
- protected Constructor[] determineConstructorsFromBeanPostProcessors(Class beanClass, String beanName)
+ protected Constructor>[] determineConstructorsFromBeanPostProcessors(Class> beanClass, String beanName)
throws BeansException {
if (beanClass != null && hasInstantiationAwareBeanPostProcessors()) {
for (BeanPostProcessor bp : getBeanPostProcessors()) {
if (bp instanceof SmartInstantiationAwareBeanPostProcessor) {
SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp;
- Constructor[] ctors = ibp.determineCandidateConstructors(beanClass, beanName);
+ Constructor>[] ctors = ibp.determineCandidateConstructors(beanClass, beanName);
if (ctors != null) {
return ctors;
}
@@ -1044,7 +1046,7 @@ protected BeanWrapper instantiateUsingFactoryMethod(
* @return BeanWrapper for the new instance
*/
protected BeanWrapper autowireConstructor(
- String beanName, RootBeanDefinition mbd, Constructor[] ctors, Object[] explicitArgs) {
+ String beanName, RootBeanDefinition mbd, Constructor>[] ctors, Object[] explicitArgs) {
return new ConstructorResolver(this).autowireConstructor(beanName, mbd, ctors, explicitArgs);
}
@@ -1346,7 +1348,7 @@ protected void applyPropertyValues(String beanName, BeanDefinition mbd, BeanWrap
MutablePropertyValues mpvs = null;
List original;
-
+
if (System.getSecurityManager()!= null) {
if (bw instanceof BeanWrapperImpl) {
((BeanWrapperImpl) bw).setSecurityContext(getAccessControlContext());
@@ -1473,7 +1475,7 @@ public Object run() {
else {
invokeAwareMethods(beanName, bean);
}
-
+
Object wrappedBean = bean;
if (mbd == null || !mbd.isSynthetic()) {
wrappedBean = applyBeanPostProcessorsBeforeInitialization(wrappedBean, beanName);
@@ -1540,7 +1542,7 @@ public Object run() throws Exception {
catch (PrivilegedActionException pae) {
throw pae.getException();
}
- }
+ }
else {
((InitializingBean) bean).afterPropertiesSet();
}
@@ -1583,9 +1585,9 @@ protected void invokeCustomInitMethod(String beanName, final Object bean, RootBe
}
if (logger.isDebugEnabled()) {
- logger.debug("Invoking init method '" + initMethodName + "' on bean with name '" + beanName + "'");
+ logger.debug("Invoking init method '" + initMethodName + "' on bean with name '" + beanName + "'");
}
-
+
if (System.getSecurityManager() != null) {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws Exception {
@@ -1610,7 +1612,7 @@ public Object run() throws Exception {
try {
ReflectionUtils.makeAccessible(initMethod);
initMethod.invoke(bean);
- }
+ }
catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
index 652d45afb218..1eebd1731d79 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
@@ -382,7 +382,7 @@ public Class> getBeanClass() throws IllegalStateException {
throw new IllegalStateException(
"Bean class name [" + beanClassObject + "] has not been resolved into an actual Class");
}
- return (Class) beanClassObject;
+ return (Class>) beanClassObject;
}
public void setBeanClassName(String beanClassName) {
@@ -392,7 +392,7 @@ public void setBeanClassName(String beanClassName) {
public String getBeanClassName() {
Object beanClassObject = this.beanClass;
if (beanClassObject instanceof Class) {
- return ((Class) beanClassObject).getName();
+ return ((Class>) beanClassObject).getName();
}
else {
return (String) beanClassObject;
@@ -407,12 +407,12 @@ public String getBeanClassName() {
* @return the resolved bean class
* @throws ClassNotFoundException if the class name could be resolved
*/
- public Class resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException {
+ public Class> resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException {
String className = getBeanClassName();
if (className == null) {
return null;
}
- Class resolvedClass = ClassUtils.forName(className, classLoader);
+ Class> resolvedClass = ClassUtils.forName(className, classLoader);
this.beanClass = resolvedClass;
return resolvedClass;
}
@@ -550,8 +550,8 @@ public int getResolvedAutowireMode() {
// Work out whether to apply setter autowiring or constructor autowiring.
// If it has a no-arg constructor it's deemed to be setter autowiring,
// otherwise we'll try constructor autowiring.
- Constructor[] constructors = getBeanClass().getConstructors();
- for (Constructor constructor : constructors) {
+ Constructor>[] constructors = getBeanClass().getConstructors();
+ for (Constructor> constructor : constructors) {
if (constructor.getParameterTypes().length == 0) {
return AUTOWIRE_BY_TYPE;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java
index d0f524ed7d1a..088b84499390 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java
index 58c560c91790..c8c05e6c79f0 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ public class AutowireCandidateQualifier extends BeanMetadataAttributeAccessor {
* given type.
* @param type the annotation type
*/
- public AutowireCandidateQualifier(Class type) {
+ public AutowireCandidateQualifier(Class> type) {
this(type.getName());
}
@@ -64,7 +64,7 @@ public AutowireCandidateQualifier(String typeName) {
* @param type the annotation type
* @param value the annotation value to match
*/
- public AutowireCandidateQualifier(Class type, Object value) {
+ public AutowireCandidateQualifier(Class> type, Object value) {
this(type.getName(), value);
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java
index cb1bce28eee8..de7849216160 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,9 +49,9 @@ abstract class AutowireUtils {
* decreasing number of arguments.
* @param constructors the constructor array to sort
*/
- public static void sortConstructors(Constructor[] constructors) {
- Arrays.sort(constructors, new Comparator() {
- public int compare(Constructor c1, Constructor c2) {
+ public static void sortConstructors(Constructor>[] constructors) {
+ Arrays.sort(constructors, new Comparator>() {
+ public int compare(Constructor> c1, Constructor> c2) {
boolean p1 = Modifier.isPublic(c1.getModifiers());
boolean p2 = Modifier.isPublic(c2.getModifiers());
if (p1 != p2) {
@@ -103,7 +103,7 @@ public static boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) {
}
// It was declared by CGLIB, but we might still want to autowire it
// if it was actually declared by the superclass.
- Class superclass = wm.getDeclaringClass().getSuperclass();
+ Class> superclass = wm.getDeclaringClass().getSuperclass();
return !ClassUtils.hasMethod(superclass, wm.getName(), wm.getParameterTypes());
}
@@ -114,11 +114,11 @@ public static boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) {
* @param interfaces the Set of interfaces (Class objects)
* @return whether the setter method is defined by an interface
*/
- public static boolean isSetterDefinedInInterface(PropertyDescriptor pd, Set interfaces) {
+ public static boolean isSetterDefinedInInterface(PropertyDescriptor pd, Set> interfaces) {
Method setter = pd.getWriteMethod();
if (setter != null) {
- Class targetClass = setter.getDeclaringClass();
- for (Class ifc : interfaces) {
+ Class> targetClass = setter.getDeclaringClass();
+ for (Class> ifc : interfaces) {
if (ifc.isAssignableFrom(targetClass) &&
ClassUtils.hasMethod(ifc, setter.getName(), setter.getParameterTypes())) {
return true;
@@ -135,9 +135,9 @@ public static boolean isSetterDefinedInInterface(PropertyDescriptor pd, Set requiredType) {
if (autowiringValue instanceof ObjectFactory && !requiredType.isInstance(autowiringValue)) {
- ObjectFactory factory = (ObjectFactory) autowiringValue;
+ ObjectFactory> factory = (ObjectFactory>) autowiringValue;
if (autowiringValue instanceof Serializable && requiredType.isInterface()) {
autowiringValue = Proxy.newProxyInstance(requiredType.getClassLoader(),
new Class[] {requiredType}, new ObjectFactoryDelegatingInvocationHandler(factory));
@@ -155,9 +155,9 @@ public static Object resolveAutowiringValue(Object autowiringValue, Class requir
*/
private static class ObjectFactoryDelegatingInvocationHandler implements InvocationHandler, Serializable {
- private final ObjectFactory objectFactory;
+ private final ObjectFactory> objectFactory;
- public ObjectFactoryDelegatingInvocationHandler(ObjectFactory objectFactory) {
+ public ObjectFactoryDelegatingInvocationHandler(ObjectFactory> objectFactory) {
this.objectFactory = objectFactory;
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java
index 3b338d5b27b8..47fc6f0275b7 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
* @author Juergen Hoeller
* @since 2.0
*/
-public class BeanDefinitionBuilder {
+public class BeanDefinitionBuilder {
/**
* Create a new BeanDefinitionBuilder used to construct a {@link GenericBeanDefinition}.
@@ -45,7 +45,7 @@ public static BeanDefinitionBuilder genericBeanDefinition() {
* Create a new BeanDefinitionBuilder used to construct a {@link GenericBeanDefinition}.
* @param beanClass the Class of the bean that the definition is being created for
*/
- public static BeanDefinitionBuilder genericBeanDefinition(Class beanClass) {
+ public static BeanDefinitionBuilder genericBeanDefinition(Class> beanClass) {
BeanDefinitionBuilder builder = new BeanDefinitionBuilder();
builder.beanDefinition = new GenericBeanDefinition();
builder.beanDefinition.setBeanClass(beanClass);
@@ -67,7 +67,7 @@ public static BeanDefinitionBuilder genericBeanDefinition(String beanClassName)
* Create a new BeanDefinitionBuilder used to construct a {@link RootBeanDefinition}.
* @param beanClass the Class of the bean that the definition is being created for
*/
- public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass) {
+ public static BeanDefinitionBuilder rootBeanDefinition(Class> beanClass) {
return rootBeanDefinition(beanClass, null);
}
@@ -76,7 +76,7 @@ public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass) {
* @param beanClass the Class of the bean that the definition is being created for
* @param factoryMethodName the name of the method to use to construct the bean instance
*/
- public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass, String factoryMethodName) {
+ public static BeanDefinitionBuilder rootBeanDefinition(Class> beanClass, String factoryMethodName) {
BeanDefinitionBuilder builder = new BeanDefinitionBuilder();
builder.beanDefinition = new RootBeanDefinition();
builder.beanDefinition.setBeanClass(beanClass);
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java
index 382cc32069e1..00d5c0bbc0f4 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java
@@ -20,7 +20,7 @@
/**
* A simple holder for BeanDefinition property defaults.
- *
+ *
* @author Mark Fisher
* @since 2.5
*/
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java
index e5fb9c6afbe7..330b699096bf 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ public String getDescription() {
@Override
public boolean equals(Object obj) {
return (obj == this ||
- (obj instanceof BeanDefinitionResource &&
+ (obj instanceof BeanDefinitionResource &&
((BeanDefinitionResource) obj).beanDefinition.equals(this.beanDefinition)));
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java
index d794b3a4efb0..011a7bb05e63 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java
@@ -128,7 +128,7 @@ else if (value instanceof BeanDefinition) {
else if (value instanceof ManagedArray) {
// May need to resolve contained runtime references.
ManagedArray array = (ManagedArray) value;
- Class elementType = array.resolvedElementType;
+ Class> elementType = array.resolvedElementType;
if (elementType == null) {
String elementTypeName = array.getElementTypeName();
if (StringUtils.hasText(elementTypeName)) {
@@ -164,7 +164,7 @@ else if (value instanceof ManagedMap) {
else if (value instanceof ManagedProperties) {
Properties original = (Properties) value;
Properties copy = new Properties();
- for (Map.Entry propEntry : original.entrySet()) {
+ for (Map.Entry, ?> propEntry : original.entrySet()) {
Object propKey = propEntry.getKey();
Object propValue = propEntry.getValue();
if (propKey instanceof TypedStringValue) {
@@ -272,7 +272,7 @@ private Object resolveInnerBean(Object argName, String innerBeanName, BeanDefini
this.beanFactory.registerContainedBean(actualInnerBeanName, this.beanName);
if (innerBean instanceof FactoryBean) {
boolean synthetic = (mbd != null && mbd.isSynthetic());
- return this.beanFactory.getObjectFromFactoryBean((FactoryBean) innerBean, actualInnerBeanName, !synthetic);
+ return this.beanFactory.getObjectFromFactoryBean((FactoryBean>) innerBean, actualInnerBeanName, !synthetic);
}
else {
return innerBean;
@@ -335,11 +335,11 @@ private Object resolveReference(Object argName, RuntimeBeanReference ref) {
/**
* For each element in the managed array, resolve reference if necessary.
*/
- private Object resolveManagedArray(Object argName, List> ml, Class elementType) {
+ private Object resolveManagedArray(Object argName, List> ml, Class> elementType) {
Object resolved = Array.newInstance(elementType, ml.size());
for (int i = 0; i < ml.size(); i++) {
Array.set(resolved, i,
- resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
+ resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
}
return resolved;
}
@@ -347,11 +347,11 @@ private Object resolveManagedArray(Object argName, List> ml, Class elementType
/**
* For each element in the managed list, resolve reference if necessary.
*/
- private List resolveManagedList(Object argName, List> ml) {
+ private List> resolveManagedList(Object argName, List> ml) {
List resolved = new ArrayList