diff options
Diffstat (limited to 'spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java')
-rw-r--r-- | spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java | 25 |
1 files changed, 22 insertions, 3 deletions
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 d20e5222..dd8823ec 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 @@ -16,6 +16,10 @@ package org.springframework.aop.aspectj.annotation; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; + import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.AjType; import org.aspectj.lang.reflect.AjTypeSystem; @@ -40,7 +44,8 @@ import org.springframework.aop.support.ComposablePointcut; * @since 2.0 * @see org.springframework.aop.aspectj.AspectJExpressionPointcut */ -public class AspectMetadata { +@SuppressWarnings("serial") +public class AspectMetadata implements Serializable { /** * The name of this aspect as defined to Spring (the bean name) - @@ -50,9 +55,16 @@ public class AspectMetadata { private final String aspectName; /** + * The aspect class, stored separately for re-resolution of the + * corresponding AjType on deserialization. + */ + private final Class<?> aspectClass; + + /** * AspectJ reflection information (AspectJ 5 / Java 5 specific). + * Re-resolved on deserialization since it isn't serializable itself. */ - private final AjType<?> ajType; + private transient AjType<?> ajType; /** * Spring AOP pointcut corresponding to the per clause of the @@ -86,6 +98,7 @@ public class AspectMetadata { if (ajType.getDeclarePrecedence().length > 0) { throw new IllegalArgumentException("DeclarePrecendence not presently supported in Spring AOP"); } + this.aspectClass = ajType.getJavaClass(); this.ajType = ajType; switch (this.ajType.getPerClause().getKind()) { @@ -132,7 +145,7 @@ public class AspectMetadata { * Return the aspect class. */ public Class<?> getAspectClass() { - return this.ajType.getJavaClass(); + return this.aspectClass; } /** @@ -173,4 +186,10 @@ public class AspectMetadata { return (isPerThisOrPerTarget() || isPerTypeWithin()); } + + private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException { + inputStream.defaultReadObject(); + this.ajType = AjTypeSystem.getAjType(this.aspectClass); + } + } |