[jboss-cvs] JBossAS SVN: r59386 - in projects/aop/trunk/aop/src: main/org/jboss/aop/advice main/org/jboss/aop/advice/annotation main/org/jboss/aop/instrument resources/test/beforeafterArgs test/org/jboss/test/aop/beforeafterArgs
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 5 14:53:54 EST 2007
Author: flavia.rainone
Date: 2007-01-05 14:53:15 -0500 (Fri, 05 Jan 2007)
New Revision: 59386
Added:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerAspect.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetCallerPOJO.java
Removed:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AnnotatedParameterAdviceInfo.java
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java
projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java
projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml
projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java
Log:
[JBAOP-327] Caller parameter support implemented and tested
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/AdviceMethodProperties.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -40,14 +40,12 @@
public static final int RETURN_ARG = -4;
public static final int THROWABLE_ARG = -5;
public static final int ARGS_ARG = -6;
- public static final int CALLEE_ARG = -7;
- public static final int CALLER_ARG = -8;
- public static final int ARG_ARG = -9;
+ public static final int CALLER_ARG = -7;
+ public static final int ARG_ARG = -8;
public static final CtClass[] EMPTY_PARAMETERS = {};
- public static enum Context {STATIC, TARGET_AVAILABLE, CALLER_AVAILABLE,
- TARGET_CALLER_AVAILABLE}
+ public static enum OptionalParameters {NONE, TARGET, CALLER, TARGET_CALLER}
//find properties
private Class aspectClass;
@@ -55,10 +53,13 @@
private Class infoType;
private Class invocationType;
private Class target;
+ private Class caller;
private Class joinpointReturnType;
private Class[] joinpointParameters;
private Class[] joinpointExceptions;
- private Context context;
+ private OptionalParameters optionalParameters;
+ private boolean targetAvailable;
+ private boolean callerAvailable;
//found properties
private Method adviceMethod;
@@ -71,9 +72,7 @@
Class invocationType,
Class joinpointReturnType,
Class[] joinpointParameters,
- Class[] joinpointExceptions,
- Class target,
- Context context)
+ Class[] joinpointExceptions)
{
this.aspectClass = aspectClass;
this.adviceName = adviceName;
@@ -82,9 +81,46 @@
this.joinpointReturnType = joinpointReturnType;
this.joinpointParameters = joinpointParameters;
this.joinpointExceptions = joinpointExceptions;
+ this.optionalParameters = OptionalParameters.NONE;
+ }
+
+ public AdviceMethodProperties(
+ Class aspectClass,
+ String adviceName,
+ Class infoType,
+ Class invocationType,
+ Class joinpointReturnType,
+ Class[] joinpointParameters,
+ Class[] joinpointExceptions,
+ Class target,
+ boolean targetAvailable)
+ {
+ this(aspectClass, adviceName, infoType, invocationType, joinpointReturnType,
+ joinpointParameters, joinpointExceptions);
this.target = target;
- this.context = context;
+ this.targetAvailable = targetAvailable;
+ this.optionalParameters = OptionalParameters.TARGET;
}
+
+ public AdviceMethodProperties(
+ Class aspectClass,
+ String adviceName,
+ Class infoType,
+ Class invocationType,
+ Class joinpointReturnType,
+ Class[] joinpointParameters,
+ Class[] joinpointExceptions,
+ Class target,
+ boolean targetAvailable,
+ Class caller,
+ boolean callerAvailable)
+ {
+ this (aspectClass, adviceName, infoType, invocationType, joinpointReturnType,
+ joinpointParameters, joinpointExceptions, target, targetAvailable);
+ this.caller = caller;
+ this.callerAvailable = callerAvailable;
+ this.optionalParameters = OptionalParameters.TARGET_CALLER;
+ }
public void setFoundProperties(Method adviceMethod, int[] args)
{
@@ -152,9 +188,29 @@
{
return this.target;
}
+
+ public boolean isTargetAvailable()
+ {
+ return this.targetAvailable;
+ }
- public Context getContext()
+ public Class getCallerType()
{
- return this.context;
+ return this.caller;
}
+
+ public boolean isCallerAvailable()
+ {
+ return this.callerAvailable;
+ }
+
+ public OptionalParameters getOptionalParameters()
+ {
+ return this.optionalParameters;
+ }
+
+ public void setOptionalParameters(OptionalParameters optionalParameters)
+ {
+ this.optionalParameters = optionalParameters;
+ }
}
\ No newline at end of file
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AdviceMethodFactory.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -257,27 +257,27 @@
ParameterAnnotationRule[] contextRules = null;
int[][] mutuallyExclusive = null;
- switch(properties.getContext())
+ switch(properties.getOptionalParameters())
{
- case STATIC:
+ case NONE:
contextRules = FULLY_STATIC;
mutuallyExclusive = FS_INCOMPATIBILITY;
break;
- case TARGET_AVAILABLE:
+ case TARGET:
contextRules = TARGET_AVAILABLE;
mutuallyExclusive = TA_INCOMPATIBILITY;
break;
- case CALLER_AVAILABLE:
+ case CALLER:
contextRules = CALLER_AVAILABLE;
mutuallyExclusive = CA_INCOMPATIBILITY;
break;
- case TARGET_CALLER_AVAILABLE:
+ case TARGET_CALLER:
contextRules = TARGET_CALLER_AVAILABLE;
mutuallyExclusive = TCA_INCOMPATIBILITY;
break;
default:
- throw new RuntimeException("Unexpected Context Type " +
- properties.getContext());
+ throw new RuntimeException("Unexpected Optional Parameters Option" +
+ properties.getOptionalParameters());
}
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AnnotatedParameterAdviceInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AnnotatedParameterAdviceInfo.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/AnnotatedParameterAdviceInfo.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -229,7 +229,7 @@
// this happens when target or caller are nulls
// in this case, this advice should have the smallest rank, since
// any other advice is preferable (in case of overloaded advices)
- nullifyRank = nullifyRank || (typeFound.rule.getAssignableFrom(properties) == null);
+ nullifyRank = nullifyRank || (typeFound.rule.lowerRankGrade(properties));
}
if (nullifyRank)
{
@@ -436,13 +436,8 @@
public final boolean internalValidate(AdviceMethodProperties properties)
{
- Class assignableFrom = (Class) rule.getAssignableFrom(properties);
- if (assignableFrom == null) // targets and callers can be null
- {
- return true;
- }
if (index != -1 && !method.getParameterTypes()[index].isAssignableFrom(
- assignableFrom))
+ (Class)rule.getAssignableFrom(properties)))
{
if (AspectManager.verbose)
{
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/ParameterAnnotationRule.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -65,8 +65,13 @@
{
public Object getAssignableFrom(AdviceMethodProperties properties)
{
- return null; // TODO caller
+ return properties.getCallerType();
}
+
+ public boolean lowerRankGrade(AdviceMethodProperties properties)
+ {
+ return !properties.isCallerAvailable();
+ }
},
/**
@@ -79,6 +84,11 @@
{
return properties.getTargetType();
}
+
+ public boolean lowerRankGrade(AdviceMethodProperties properties)
+ {
+ return !properties.isTargetAvailable();
+ }
},
/**
@@ -156,6 +166,7 @@
/**
* Returns the property identifying the annotated parameter type.
+ *
* @return one of the constant values defined in {@link AdviceMethodProperties}
*/
public final int getProperty()
@@ -164,17 +175,31 @@
}
/**
- * Returns the rank grade an annotaed parameter is worth for an instance of <code>
- * AdviceInfo</code>.
+ * Returns the rank grade an annotated parameter is worth for an instance of
+ * <code>AdviceInfo</code>.
*
* @return the rank grade
*/
public final int getRankGrade()
{
return rankGrade;
- }
+ }
/**
+ * Returns <code>true</code> if, in the context especified by <code>properties
+ * </code>, an advice method should have a lower grade when he attends to this
+ * rule.
+ *
+ * @param properties describes the queried advice method
+ * @return <code>true</code> if an advice compliant with this rule should have
+ * a lower rank grade
+ */
+ public boolean lowerRankGrade(AdviceMethodProperties properties)
+ {
+ return false;
+ }
+
+ /**
* Indicates whether this annotation is mandatory.
*
* @return <code>true</code> only if this annotation is mandatory
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByConJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -37,7 +37,6 @@
import org.jboss.aop.GeneratedClassAdvisor;
import org.jboss.aop.JoinPointInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
import org.jboss.aop.joinpoint.ConstructorCalledByConstructorInvocation;
import org.jboss.aop.util.ReflectToJavassist;
@@ -121,9 +120,7 @@
INVOCATION_TYPE,
ctor.getDeclaringClass(),
ctor.getParameterTypes(),
- ctor.getExceptionTypes(),
- null,
- Context.CALLER_AVAILABLE);
+ ctor.getExceptionTypes());
}
protected boolean isCaller()
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConByMethodJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -37,7 +37,7 @@
import org.jboss.aop.GeneratedClassAdvisor;
import org.jboss.aop.JoinPointInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
+import org.jboss.aop.advice.AdviceMethodProperties.OptionalParameters;
import org.jboss.aop.joinpoint.ConstructorCalledByMethodInvocation;
import org.jboss.aop.util.ReflectToJavassist;
@@ -122,16 +122,20 @@
protected AdviceMethodProperties getAdviceMethodProperties(AdviceSetup setup)
{
Constructor ctor = ((ConByMethodInfo)info).getConstructor();
- return new AdviceMethodProperties(
- setup.getAspectClass(),
- setup.getAdviceName(),
- info.getClass(),
- INVOCATION_TYPE,
- ctor.getDeclaringClass(),
- ctor.getParameterTypes(),
- ctor.getExceptionTypes(),
- null,
- hasCallingObject()? Context.CALLER_AVAILABLE: Context.STATIC);
+ AdviceMethodProperties properties = new AdviceMethodProperties(
+ setup.getAspectClass(),
+ setup.getAdviceName(),
+ info.getClass(),
+ INVOCATION_TYPE,
+ ctor.getDeclaringClass(),
+ ctor.getParameterTypes(),
+ ctor.getExceptionTypes(),
+ null,
+ false,
+ ((ConByMethodInfo) info).getCallingClass(),
+ hasCallingObject());
+ properties.setOptionalParameters(OptionalParameters.CALLER);
+ return properties;
}
protected boolean isCaller()
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructionJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -38,7 +38,6 @@
import org.jboss.aop.GeneratedClassAdvisor;
import org.jboss.aop.JoinPointInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
import org.jboss.aop.joinpoint.ConstructionInvocation;
import org.jboss.aop.util.ReflectToJavassist;
@@ -116,7 +115,7 @@
ctor.getParameterTypes(),
ctor.getExceptionTypes(),
ctor.getDeclaringClass(),
- Context.TARGET_AVAILABLE);
+ true);
}
protected boolean hasTargetObject()
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/ConstructorJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -38,7 +38,6 @@
import org.jboss.aop.GeneratedClassAdvisor;
import org.jboss.aop.JoinPointInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
import org.jboss.aop.joinpoint.ConstructorInvocation;
import org.jboss.aop.util.ReflectToJavassist;
@@ -115,9 +114,7 @@
INVOCATION_TYPE,
ctor.getDeclaringClass(),
ctor.getParameterTypes(),
- ctor.getExceptionTypes(),
- null,
- Context.STATIC);
+ ctor.getExceptionTypes());
}
protected boolean hasTargetObject()
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/FieldJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -37,7 +37,6 @@
import org.jboss.aop.GeneratedClassAdvisor;
import org.jboss.aop.JoinPointInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
import org.jboss.aop.joinpoint.FieldReadInvocation;
import org.jboss.aop.joinpoint.FieldWriteInvocation;
import org.jboss.aop.util.JavassistToReflect;
@@ -123,9 +122,7 @@
protected AdviceMethodProperties getAdviceMethodProperties(AdviceSetup setup)
{
Field field = ((FieldInfo)info).getAdvisedField();
- if (hasTargetObject())
- {
- return new AdviceMethodProperties(
+ return new AdviceMethodProperties(
setup.getAspectClass(),
setup.getAdviceName(),
info.getClass(),
@@ -134,18 +131,7 @@
(read()) ? new Class[] {} : new Class[] {field.getType()},
null,
field.getDeclaringClass(),
- Context.TARGET_AVAILABLE);
- }
- return new AdviceMethodProperties(
- setup.getAspectClass(),
- setup.getAdviceName(),
- info.getClass(),
- (read()) ? READ_INVOCATION_TYPE : WRITE_INVOCATION_TYPE,
- (read()) ? getReturnType() : Void.TYPE,
- (read()) ? new Class[] {} : new Class[] {field.getType()},
- null,
- null,
- Context.TARGET_AVAILABLE);
+ hasTargetObject());
}
protected CtClass[] getJoinpointParameters() throws NotFoundException
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -87,32 +87,32 @@
this.listPrefix = listPrefix;
}
- public boolean hasTarget()
+ public final boolean hasTarget()
{
return target;
}
- public int getTargetIndex()
+ public final int getTargetIndex()
{
return targetIndex;
}
- public boolean hasCaller()
+ public final boolean hasCaller()
{
return caller;
}
- public int getCallerIndex()
+ public final int getCallerIndex()
{
return callerIndex;
}
- public int getFirstArgIndex()
+ public final int getFirstArgIndex()
{
return firstArgIndex;
}
- public String declareArgsArray(int totalParameters)
+ public final String declareArgsArray(int totalParameters)
{
if (++totalParameters == firstArgIndex)
{
@@ -131,7 +131,7 @@
return buffer.toString();
}
- public void appendParameterListWithArgs(StringBuffer code, CtClass[] parameterTypes, boolean beginWithComma)
+ public final void appendParameterListWithArgs(StringBuffer code, CtClass[] parameterTypes, boolean beginWithComma)
{
int j = firstArgIndex - 1;
@@ -266,6 +266,7 @@
public static final String INVOKE_TARGET = "invokeTarget";
public static final String DISPATCH = "dispatch";
protected static final String TARGET_FIELD = "tgt";
+ protected static final String CALLER_FIELD = "callingObject";
protected static final String GENERATED_CLASS_ADVISOR = GeneratedClassAdvisor.class.getName();
public static final String GENERATE_JOINPOINT_CLASS = "generateJoinPointClass";
private static final String CURRENT_ADVICE = "super.currentInterceptor";
@@ -1692,7 +1693,7 @@
code.append(THROWABLE);
break;
case AdviceMethodProperties.TARGET_ARG:
- if (properties.getTargetType() == null)
+ if (!generator.parameters.hasTarget())
{
code.append("null");
}
@@ -1702,11 +1703,28 @@
}
else
{
- code.append("$1");
+ code.append('$');
+ code.append(generator.parameters.getTargetIndex());
}
- return true;
+ break;
+ case AdviceMethodProperties.CALLER_ARG:
+ if (!generator.parameters.hasCaller())
+ {
+ code.append("null");
+ }
+ else if (isAround)
+ {
+ code.append(CALLER_FIELD);
+ }
+ else
+ {
+ code.append('$');
+ code.append(generator.parameters.getCallerIndex());
+ }
+ break;
case AdviceMethodProperties.ARGS_ARG:
code.append(ARGUMENTS);
+ // return true when args has been found; false otherwise
return true;
default:
if (isAround)
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByConJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -37,7 +37,6 @@
import org.jboss.aop.JoinPointInfo;
import org.jboss.aop.MethodByConInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
import org.jboss.aop.joinpoint.MethodCalledByConstructorInvocation;
import org.jboss.aop.util.ReflectToJavassist;
@@ -117,9 +116,7 @@
protected AdviceMethodProperties getAdviceMethodProperties(AdviceSetup setup)
{
Method method = ((MethodByConInfo)info).getMethod();
- if (hasTargetObject())
- {
- return new AdviceMethodProperties(
+ return new AdviceMethodProperties(
setup.getAspectClass(),
setup.getAdviceName(),
info.getClass(),
@@ -128,18 +125,7 @@
method.getParameterTypes(),
method.getExceptionTypes(),
method.getDeclaringClass(),
- Context.TARGET_AVAILABLE);
- }
- return new AdviceMethodProperties(
- setup.getAspectClass(),
- setup.getAdviceName(),
- info.getClass(),
- INVOCATION_TYPE,
- method.getReturnType(),
- method.getParameterTypes(),
- method.getExceptionTypes(),
- null,
- Context.TARGET_AVAILABLE);
+ hasTargetObject());
}
protected boolean isCaller()
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodByMethodJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -37,7 +37,6 @@
import org.jboss.aop.JoinPointInfo;
import org.jboss.aop.MethodByMethodInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
import org.jboss.aop.joinpoint.MethodCalledByMethodInvocation;
import org.jboss.aop.util.ReflectToJavassist;
@@ -124,9 +123,7 @@
protected AdviceMethodProperties getAdviceMethodProperties(AdviceSetup setup)
{
Method method = ((MethodByMethodInfo)info).getMethod();
- if (hasTargetObject())
- {
- return new AdviceMethodProperties(
+ return new AdviceMethodProperties(
setup.getAspectClass(),
setup.getAdviceName(),
info.getClass(),
@@ -135,22 +132,9 @@
method.getParameterTypes(),
method.getExceptionTypes(),
method.getDeclaringClass(),
- hasCallingObject()?
- Context.TARGET_CALLER_AVAILABLE:
- Context.TARGET_AVAILABLE);
- }
- return new AdviceMethodProperties(
- setup.getAspectClass(),
- setup.getAdviceName(),
- info.getClass(),
- INVOCATION_TYPE,
- method.getReturnType(),
- method.getParameterTypes(),
- method.getExceptionTypes(),
- null,
- hasCallingObject()?
- Context.TARGET_CALLER_AVAILABLE:
- Context.TARGET_AVAILABLE);
+ hasTargetObject(),
+ ((MethodByMethodInfo) info).getCallingClass(),
+ hasCallingObject());
}
protected boolean isCaller()
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/MethodJoinPointGenerator.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -36,7 +36,6 @@
import org.jboss.aop.GeneratedClassAdvisor;
import org.jboss.aop.MethodInfo;
import org.jboss.aop.advice.AdviceMethodProperties;
-import org.jboss.aop.advice.AdviceMethodProperties.Context;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.aop.util.ReflectToJavassist;
@@ -110,9 +109,7 @@
protected AdviceMethodProperties getAdviceMethodProperties(AdviceSetup setup)
{
Method method = ((MethodInfo)info).getAdvisedMethod();
- if (hasTargetObject())
- {
- return new AdviceMethodProperties(
+ return new AdviceMethodProperties(
setup.getAspectClass(),
setup.getAdviceName(),
info.getClass(),
@@ -121,18 +118,7 @@
method.getParameterTypes(),
method.getExceptionTypes(),
method.getDeclaringClass(),
- Context.TARGET_AVAILABLE);
- }
- return new AdviceMethodProperties(
- setup.getAspectClass(),
- setup.getAdviceName(),
- info.getClass(),
- INVOCATION_TYPE,
- method.getReturnType(),
- method.getParameterTypes(),
- method.getExceptionTypes(),
- null,
- Context.TARGET_AVAILABLE);
+ hasTargetObject());
}
Modified: projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/resources/test/beforeafterArgs/jboss-aop.xml 2007-01-05 19:53:15 UTC (rev 59386)
@@ -61,7 +61,32 @@
<after name="after8" aspect="org.jboss.test.aop.beforeafterArgs.ArgsAspect" />
<throwing name="throwing" aspect="org.jboss.test.aop.beforeafterArgs.ArgsAspect" />
</bind>
+
+ <!-- @Caller test -->
+ <aspect class="org.jboss.test.aop.beforeafterArgs.CallerAspect" scope="PER_VM"/>
+ <stack name="CallerAdvices">
+ <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <before name="before3" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <before name="before4" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <advice name="around1" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <advice name="around2" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <advice name="around3" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <advice name="around4" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <after name="after1" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <after name="after2" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ <after name="after3" aspect="org.jboss.test.aop.beforeafterArgs.CallerAspect"/>
+ </stack>
+
+ <bind pointcut="call(org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO2->new(int))">
+ <stack-ref name="CallerAdvices"/>
+ </bind>
+
+ <bind pointcut="call(void org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO2->*())">
+ <stack-ref name="CallerAdvices"/>
+ </bind>
+
<!-- @JoinPoint test -->
<aspect class="org.jboss.test.aop.beforeafterArgs.JoinPointAspect" scope="PER_VM"/>
@@ -172,58 +197,37 @@
<!-- @Target test -->
<aspect class="org.jboss.test.aop.beforeafterArgs.TargetAspect" scope="PER_VM"/>
- <bind pointcut="execution(org.jboss.test.aop.beforeafterArgs.TargetPOJO->new(int))">
- <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ <stack name="TargetAdvices">
+ <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
<before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
<advice name="around1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
<advice name="around2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
<after name="after1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
<after name="after2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ </stack>
+
+ <bind pointcut="execution(org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO->new(int))">
+ <stack-ref name="TargetAdvices"/>
</bind>
- <bind pointcut="field(int org.jboss.test.aop.beforeafterArgs.TargetPOJO->*)">
- <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ <bind pointcut="field(int org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO->*)">
+ <stack-ref name="TargetAdvices"/>
</bind>
- <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.TargetPOJO->method1(..))">
- <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO->method1(..))">
+ <stack-ref name="TargetAdvices"/>
</bind>
- <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.TargetPOJO->method2(..))">
- <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ <bind pointcut="execution(* org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO->method2(..))">
+ <stack-ref name="TargetAdvices"/>
</bind>
- <bind pointcut="call(org.jboss.test.aop.beforeafterArgs.TargetPOJO2->new(int))">
- <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ <bind pointcut="call(org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO2->new(int))">
+ <stack-ref name="TargetAdvices"/>
</bind>
- <bind pointcut="call(void org.jboss.test.aop.beforeafterArgs.TargetPOJO2->*())">
- <before name="before1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <before name="before2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <advice name="around2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after1" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
- <after name="after2" aspect="org.jboss.test.aop.beforeafterArgs.TargetAspect"/>
+ <bind pointcut="call(void org.jboss.test.aop.beforeafterArgs.TargetCallerPOJO2->*())">
+ <stack-ref name="TargetAdvices"/>
</bind>
<!-- @Thrown test -->
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerAspect.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerAspect.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.beforeafterArgs;
+
+import junit.framework.Assert;
+
+import org.jboss.aop.advice.annotation.Caller;
+import org.jboss.aop.joinpoint.CurrentInvocation;
+
+/**
+ * Aspect used on @Caller parameter tests.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class CallerAspect
+{
+ static boolean before1 = false;
+ static boolean before2 = false;
+ static boolean before3 = false;
+ static boolean around1 = false;
+ static boolean around2 = false;
+ static boolean around4 = false;
+ static boolean after1 = false;
+ static boolean after2 = false;
+
+ static Object before2Caller = null;
+ static Object before3Caller = null;
+ static Object around2Caller = null;
+ static Object around4Caller = null;
+ static Object after2Caller = null;
+
+ public static void clear()
+ {
+ before1 = false;
+ before2 = false;
+ before3 = false;
+ around1 = false;
+ around2 = false;
+ around4 = false;
+ after1 = false;
+ after2 = false;
+ before2Caller = null;
+ before3Caller = null;
+ around2Caller = null;
+ around4Caller = null;
+ after2Caller = null;
+ }
+
+
+ public void before1()
+ {
+ before1 = true;
+ }
+
+ public void before2(@Caller Object caller)
+ {
+ before2 = true;
+ before2Caller = caller;
+ }
+
+ public void before3(@Caller TargetCallerPOJO caller)
+ {
+ before3 = true;
+ before3Caller = caller;
+ }
+
+ public void before4(@Caller ArgsPOJO caller)
+ {
+ Assert.fail("This advice should never be executed");
+ }
+
+ public Object around1() throws Throwable
+ {
+ around1 = true;
+ return CurrentInvocation.proceed();
+ }
+
+ public Object around2(@Caller TargetCallerPOJO caller) throws Throwable
+ {
+ around2 = true;
+ around2Caller = caller;
+ return CurrentInvocation.proceed();
+ }
+
+ public Object around3(@Caller String caller) throws Throwable
+ {
+ Assert.fail("This advice should never be executed");
+ return null;
+ }
+
+ public Object around4(@Caller Object caller) throws Throwable
+ {
+ around4 = true;
+ around4Caller = caller;
+ return CurrentInvocation.proceed();
+ }
+
+ public void after1()
+ {
+ after1 = true;
+ }
+
+ public void after2(@Caller Object caller)
+ {
+ after2 = true;
+ after2Caller = caller;
+ }
+
+ public void after3(@Caller TargetCallerPOJO2 caller)
+ {
+ Assert.fail("This advice should never be executed");
+ }
+}
\ No newline at end of file
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerTestCase.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/CallerTestCase.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.beforeafterArgs;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.aop.AOPTestWithSetup;
+
+/**
+ * Tests the use of @Caller parameters.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class CallerTestCase extends AOPTestWithSetup
+{
+ private TargetCallerPOJO pojo;
+
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("CallerTestCase");
+ suite.addTestSuite(CallerTestCase.class);
+ return suite;
+ }
+
+ public CallerTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ CallerAspect.clear();
+ this.pojo = new TargetCallerPOJO();
+ }
+
+ public void test1() throws Exception
+ {
+ pojo.method3();
+ assertAllAdvices(pojo);
+ }
+
+ public void test2() throws Exception
+ {
+ pojo.method4();
+ assertAllAdvices(pojo);
+ }
+
+ public void test3() throws Exception
+ {
+ pojo.method5();
+ assertAllAdvices(pojo);
+ }
+
+ public void test4() throws Exception
+ {
+ TargetCallerPOJO.method6();
+ assertAllAdvices(null);
+ }
+
+ public void test5() throws Exception
+ {
+ TargetCallerPOJO.method7();
+ assertAllAdvices(null);
+ }
+
+ public void test6() throws Exception
+ {
+ TargetCallerPOJO.method8();
+ assertAllAdvices(null);
+ }
+
+ public void assertAllAdvices(Object caller)
+ {
+ assertTrue(CallerAspect.before1);
+ assertTrue(CallerAspect.before2);
+ assertTrue(CallerAspect.before3);
+ assertTrue(CallerAspect.around1);
+ assertTrue(CallerAspect.around2);
+ assertTrue(CallerAspect.around4);
+ assertTrue(CallerAspect.after1);
+ assertTrue(CallerAspect.after2);
+ assertSame(caller, CallerAspect.before2Caller);
+ assertSame(CallerAspect.before2Caller, CallerAspect.before3Caller);
+ assertSame(CallerAspect.before3Caller, CallerAspect.around2Caller);
+ assertSame(CallerAspect.around2Caller, CallerAspect.around4Caller);
+ assertSame(CallerAspect.around4Caller, CallerAspect.after2Caller);
+ }
+}
\ No newline at end of file
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetCallerPOJO.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetCallerPOJO.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetCallerPOJO.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.aop.beforeafterArgs;
+
+
+/**
+ * Plain old java object used on both @Target and @Caller parameter tests.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class TargetCallerPOJO
+{
+ public TargetCallerPOJO(){}
+ public TargetCallerPOJO(int x){}
+
+ public int field1;
+ public static int field2;
+
+ public void method1(){}
+ public static void method2(){}
+
+ public void method3(){
+ new TargetCallerPOJO2(3);
+ }
+
+ public void method4()
+ {
+ TargetCallerPOJO2 pojo2 = new TargetCallerPOJO2();
+ pojo2.method1();
+ }
+
+ public void method5()
+ {
+ TargetCallerPOJO2.method2();
+ }
+
+ public static void method6(){
+ new TargetCallerPOJO2(3);
+ }
+
+ public static void method7()
+ {
+ TargetCallerPOJO2 pojo2 = new TargetCallerPOJO2();
+ pojo2.method1();
+ }
+
+ public static void method8()
+ {
+ TargetCallerPOJO2.method2();
+ }
+}
+
+class TargetCallerPOJO2
+{
+ public TargetCallerPOJO2(){}
+ public TargetCallerPOJO2(int x){}
+ public void method1(){}
+ public static void method2(){}
+}
\ No newline at end of file
Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetPOJO.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.aop.beforeafterArgs;
-
-
-/**
- * Plain old java object used on @Target parameter tests.
- *
- * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-public class TargetPOJO
-{
- public TargetPOJO(){}
- public TargetPOJO(int x){}
-
- public int field1;
- public static int field2;
-
- public void method1(){}
- public static void method2(){}
-
- public void method3(){
- new TargetPOJO2(3);
- }
-
- public void method4()
- {
- TargetPOJO2 pojo2 = new TargetPOJO2();
- pojo2.method1();
- }
-
- public void method5()
- {
- TargetPOJO2.method2();
- }
-
- public static void method6(){
- new TargetPOJO2(3);
- }
-
- public static void method7()
- {
- TargetPOJO2 pojo2 = new TargetPOJO2();
- pojo2.method1();
- }
-
- public static void method8()
- {
- TargetPOJO2.method2();
- }
-}
-
-class TargetPOJO2
-{
- public TargetPOJO2(){}
- public TargetPOJO2(int x){}
- public void method1(){}
- public static void method2(){}
-}
\ No newline at end of file
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java 2007-01-05 19:20:59 UTC (rev 59385)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/beforeafterArgs/TargetTestCase.java 2007-01-05 19:53:15 UTC (rev 59386)
@@ -34,7 +34,7 @@
*/
public class TargetTestCase extends AOPTestWithSetup
{
- private TargetPOJO pojo;
+ private TargetCallerPOJO pojo;
public static void main(String[] args)
{
@@ -57,12 +57,12 @@
{
super.setUp();
TargetAspect.clear();
- this.pojo = new TargetPOJO();
+ this.pojo = new TargetCallerPOJO();
}
public void test1()
{
- new TargetPOJO(1);
+ new TargetCallerPOJO(1);
assertStaticAdvices();
}
@@ -83,14 +83,14 @@
public void test4()
{
- TargetPOJO.field2 = 5;
+ TargetCallerPOJO.field2 = 5;
assertAllAdvices();
assertTarget(null);
}
public void test5()
{
- int test = TargetPOJO.field2;
+ int test = TargetCallerPOJO.field2;
assertAllAdvices();
assertTarget(null);
}
@@ -104,7 +104,7 @@
public void test7()
{
- TargetPOJO.method2();
+ TargetCallerPOJO.method2();
assertAllAdvices();
assertTarget(null);
}
@@ -131,20 +131,20 @@
public void test11()
{
- TargetPOJO.method6();
+ TargetCallerPOJO.method6();
assertStaticAdvices();
}
public void test12()
{
- TargetPOJO.method7();
+ TargetCallerPOJO.method7();
assertAllAdvices();
assertTarget();
}
public void test13()
{
- TargetPOJO.method8();
+ TargetCallerPOJO.method8();
assertAllAdvices();
assertTarget(null);
}
More information about the jboss-cvs-commits
mailing list