[jboss-cvs] JBossAS SVN: r75393 - in projects/aop/branches/joinpoint_graph/aop/src: test/org/jboss/aop/joinpoint/graph and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 4 10:49:13 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-07-04 10:49:13 -0400 (Fri, 04 Jul 2008)
New Revision: 75393

Added:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorWrapper.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataAware.java
   projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AnnPojo.java
   projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/BehaviorFilterTest.java
Modified:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorNode.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeMetaDataKeyLoader.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldNode.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataKeyLoader.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Node.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeFilter.java
   projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AllTests.java
   projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/FieldFilterTest.java
   projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/Pojo5.java
   projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/TypeFilterTest.java
Log:
[JBAOP-508] TypeFilter, FieldFilter, and BehaviorFilter are tydied up, fully working and tested.

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -24,6 +24,7 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 
+import org.jboss.aop.Advisor;
 import org.jboss.aop.pointcut.Util;
 import org.jboss.aop.pointcut.ast.ASTBehavior;
 import org.jboss.aop.pointcut.ast.ASTConstructor;
@@ -39,20 +40,20 @@
 interface BehaviorFilter
 {
    /**
-    * Tests whether or not {@code method} is accepted or rejected by this filter.
+    * Tests whether or not {@code constructor} is accepted or rejected by this filter.
     * 
-    * @param method the method to be tested
-    * @return       {@code true} if this filter accepts {@code method}
+    * @param constructor the constructor to be tested.
+    * @return            {@code true} if this filter accepts {@code constructor}
     */
-   public boolean accept(Method method);
+   public boolean acceptConstructor(BehaviorWrapper<Constructor> constructorWrapper);
    
    /**
-    * Tests whether or not {@code constructor} is accepted or rejected by this filter.
+    * Tests whether or not {@code method} is accepted or rejected by this filter.
     * 
-    * @param constructor the constructor to be tested
-    * @return            {@code true} if this filter accepts {@code constructor}
+    * @param method the method to be tested
+    * @return       {@code true} if this filter accepts {@code method}
     */
-   public boolean accept(Constructor constructor);
+   public boolean acceptMethod(BehaviorWrapper<Method> methodWrapper);
 }
 
 /**
@@ -76,14 +77,16 @@
       this.filter2 = filter2;
    }
    
-   public boolean accept(Method method)
+   public boolean acceptConstructor(BehaviorWrapper<Constructor> constructorWrapper)
    {
-      return filter1.accept(method) && filter2.accept(method);
+      return filter1.acceptConstructor(constructorWrapper)
+         && filter2.acceptConstructor(constructorWrapper);
    }
    
-   public boolean accept(Constructor constructor)
+   public boolean acceptMethod(BehaviorWrapper<Method> methodWrapper)
    {
-      return filter1.accept(constructor) && filter2.accept(constructor);
+      return filter1.acceptMethod(methodWrapper)
+         && filter2.acceptMethod(methodWrapper);
    }
 }
 
@@ -107,16 +110,18 @@
    {
       this.classExpression = classExpression;
    }
-   
-   public boolean accept(Method method)
-   {
-      return Util.matchesClassExpr(classExpression, method.getReturnType());
-   }
 
-   public boolean accept(Constructor constructor)
+   public boolean acceptConstructor(BehaviorWrapper<Constructor> constructor)
    {
       throw new RuntimeException ("Should never be called");
    }
+   
+   public boolean acceptMethod(BehaviorWrapper<Method> methodWrapper)
+   {
+      return Util.matchesClassExpr(classExpression,
+            methodWrapper.getBehavior().getReturnType(),
+            methodWrapper.getMetaDataContainer());
+   }
 }
 
 /**
@@ -140,14 +145,18 @@
       this.classExpression = classExpression;
    }
    
-   public boolean accept(Method method)
+   public boolean acceptConstructor(BehaviorWrapper<Constructor> constructorWrapper)
    {
-      return Util.matchesClassExpr(classExpression, method.getDeclaringClass());
+      return Util.matchesClassExpr(classExpression,
+            constructorWrapper.getBehavior().getDeclaringClass(),
+            constructorWrapper.getMetaDataContainer());
    }
-
-   public boolean accept(Constructor constructor)
+   
+   public boolean acceptMethod(BehaviorWrapper<Method> methodWrapper)
    {
-      return Util.matchesClassExpr(classExpression, constructor.getDeclaringClass());
+      return Util.matchesClassExpr(classExpression,
+            methodWrapper.getBehavior().getDeclaringClass(),
+            methodWrapper.getMetaDataContainer());
    }
 }
 
@@ -157,7 +166,7 @@
  * 
  * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
  */
-class OverridenMethodFilter implements BehaviorFilter
+class ImplementedMethodFilter implements BehaviorFilter
 {
    boolean exactSuper;
    ClassExpression expression;
@@ -170,18 +179,24 @@
     * @param identifierExpression the parsed exception that contains the $implements
     *                             or $implementing declaration. 
     */
-   public OverridenMethodFilter(IdentifierExpression identifierExpression)
+   public ImplementedMethodFilter(IdentifierExpression identifierExpression)
    {
-      this.exactSuper = (identifierExpression.getType() == (IdentifierExpression.Type.IMPLEMENTS));
+      this.exactSuper = (identifierExpression.getType() ==
+         (IdentifierExpression.Type.IMPLEMENTS));
       this.expression = identifierExpression.getImplementsExpression();
    }
    
-   public boolean accept(Method method)
+   public boolean acceptConstructor(BehaviorWrapper<Constructor> constructorWrapper)
    {
+      throw new RuntimeException("This method should not be called");
+   }
+   
+   public boolean acceptMethod(BehaviorWrapper<Method> methodWrapper)
+   {
       try
       {
-         return Util.methodExistsInSuperClassOrInterface(method, expression,
-                  exactSuper, null);
+         return Util.methodExistsInSuperClassOrInterface(methodWrapper.getBehavior(),
+               expression, exactSuper, methodWrapper.getMetaDataContainer());
       }
       catch (Exception e)
       {
@@ -192,11 +207,6 @@
          throw new RuntimeException(e);
       }
    }
-   
-   public boolean accept(Constructor constructor)
-   {
-      throw new RuntimeException("This method should not be called");
-   }
 }
 
 /**
@@ -219,14 +229,16 @@
       this.astBehavior = astBehavior;
    }
    
-   public boolean accept(Method method)
+   public boolean acceptConstructor(BehaviorWrapper<Constructor> constructorWrapper)
    {
-      return Util.matchesParameters(null, (ASTMethod) astBehavior, method);
+      return Util.matchesParameters(null, (ASTConstructor) astBehavior,
+            constructorWrapper.getBehavior());
    }
    
-   public boolean accept(Constructor constructor)
+   public boolean acceptMethod(BehaviorWrapper<Method> methodWrapper)
    {
-      return Util.matchesParameters(null, (ASTConstructor) astBehavior, constructor);
+      return Util.matchesParameters(null, (ASTMethod) astBehavior,
+            methodWrapper.getBehavior());
    }
 }
 
@@ -244,7 +256,9 @@
     * of type restrictions.
     * 
     * @param parameterLength the maximum length of the parameter type restrictions to
-    *                        be checked 
+    *                        be checked. All the behaviors to be checked by this
+    *                        filter must have a number of parameters less than or
+    *                        equal to this number.
     */
    public PartialParameterFilter(int parameterLength)
    {
@@ -266,17 +280,30 @@
       classExpressions[index] = expression;
    }
    
-   public boolean accept(Method method)
+   /**
+    * {@code constructorWrapper} must contain a constructor with a number of
+    * parameters less than or equal to the length of parameters defined in the
+    * {@link #PartialParameterFilter(int) constructor}.
+    */
+   public boolean acceptConstructor(BehaviorWrapper<Constructor> constructorWrapper)
    {
-      return checkParameters(method.getParameterTypes());
+      return checkParameters(constructorWrapper.getBehavior().getParameterTypes(),
+            constructorWrapper.getMetaDataContainer());
    }
    
-   public boolean accept(Constructor constructor)
+   /**
+    * {@code methodWrapper} must contain a constructor with a number of
+    * parameters less than or equal to the length of parameters defined in the
+    * {@link #PartialParameterFilter(int) constructor}.
+    */
+   public boolean acceptMethod(BehaviorWrapper<Method> methodWrapper)
    {
-      return checkParameters(constructor.getParameterTypes());
+      return checkParameters(methodWrapper.getBehavior().getParameterTypes(),
+            methodWrapper.getMetaDataContainer());
    }
    
-   abstract protected boolean checkParameters(Class[] parameters);
+   abstract protected boolean checkParameters(Class[] parameters,
+         Advisor metaDataContainer);
 }
 
 /**
@@ -294,12 +321,13 @@
       super(parameterLength);
    }
    
-   protected boolean checkParameters(Class[] parameters)
+   protected boolean checkParameters(Class[] parameters, Advisor metaDataContainer)
    {
       for (int i = 0; i < classExpressions.length; i++)
       {
          if (classExpressions[i] != null &&
-               !Util.matchesClassExpr(classExpressions[i], parameters[i], null))
+               !Util.matchesClassExpr(classExpressions[i], parameters[i],
+                     metaDataContainer))
          {
             return false;
          }
@@ -323,13 +351,14 @@
       super(parameterLength);
    }
    
-   protected boolean checkParameters(Class[] parameters)
+   protected boolean checkParameters(Class[] parameters, Advisor metaDataContainer)
    {
       int paramIndex = parameters.length - 1;
-      for (int i = classExpressions.length; i >= 0 ; i--,paramIndex--)
+      for (int i = classExpressions.length -1; i >= 0 ; i--,paramIndex--)
       {
          if (classExpressions[i] != null &&
-               !Util.matchesClassExpr(classExpressions[i], parameters[paramIndex], null))
+               !Util.matchesClassExpr(classExpressions[i], parameters[paramIndex],
+                     metaDataContainer))
          {
             return false;
          }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorNode.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorNode.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorNode.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -45,7 +45,7 @@
  * 
  * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
  */
-class BehaviorNode implements Node
+class BehaviorNode implements Node, BehaviorWrapper
 {
    private static final CalleeMetaDataKeyLoader CALLEE_KEY_LOADER =
          new CalleeMetaDataKeyLoader();
@@ -153,6 +153,11 @@
    {
       loadMetaDataKeys(behavior, behaviorType, "", advisor, keys);
    }
+   
+   public Advisor getMetaDataContainer()
+   {
+      return this.advisor;
+   }
 
    /**
     * Returns the behavior represented by this node.

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -161,6 +161,7 @@
     * 
     * @see #setSearchType(org.jboss.aop.joinpoint.graph.BehaviorSearcher.SearchType)}
     */
+   @SuppressWarnings("all")
    public void search(ClassNode node, Collection<JoinPointInfo> result)
    {
       Collection<BehaviorNode> behaviors = node.searchBehaviors(behaviorExpression);
@@ -170,7 +171,8 @@
          {
             if (Util.matchModifiers(attributes, behaviorNode.getBehavior().getModifiers())
                && Util.matchExceptions(exceptions, behaviorNode.getExceptionTypes())
-               && (behaviorFilter == null || behaviorFilter.accept((Method) behaviorNode.getBehavior())))
+               && (behaviorFilter == null || behaviorFilter.acceptMethod(
+                     (BehaviorWrapper<Method>)behaviorNode)))
             {
                this.internalSearcher.search(behaviorNode, result);
             }
@@ -182,7 +184,8 @@
          {
             if (Util.matchModifiers(attributes, behaviorNode.getBehavior().getModifiers())
                && Util.matchExceptions(exceptions, behaviorNode.getExceptionTypes())
-               && (behaviorFilter == null || behaviorFilter.accept((Constructor) behaviorNode.getBehavior())))
+               && (behaviorFilter == null || behaviorFilter.acceptConstructor(
+                     (BehaviorWrapper<Constructor>) behaviorNode)))
             {
                this.internalSearcher.search(behaviorNode, result);
             }

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorWrapper.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorWrapper.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorWrapper.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -0,0 +1,34 @@
+/*
+ * 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.aop.joinpoint.graph;
+
+import java.lang.reflect.Member;
+
+/**
+ * 
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+interface BehaviorWrapper<B extends Member> extends MetaDataAware
+{
+   B getBehavior();
+}
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeMetaDataKeyLoader.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeMetaDataKeyLoader.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeMetaDataKeyLoader.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -122,6 +122,11 @@
       }
    }
    
+   public Advisor getMetaDataContainer()
+   {
+      return this.advisor;
+   }
+   
    private void loadCalleeClass(Class<?> clazz)
    {
       this.className = clazz.getName();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -22,12 +22,15 @@
 package org.jboss.aop.joinpoint.graph;
 
 import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
 import org.jboss.aop.CallerConstructorInfo;
 import org.jboss.aop.CallerMethodInfo;
 import org.jboss.aop.JoinPointInfo;
@@ -82,14 +85,8 @@
  */
 abstract class NonOptimizedCalleeSearcher extends CalleeSearcher
 {
-   private static ThreadLocal<Collection<JoinPointInfo>> TEMP =
-         new ThreadLocal<Collection<JoinPointInfo>>()
-   {
-      protected synchronized Collection<JoinPointInfo> initialValue()
-      {
-         return new ArrayList<JoinPointInfo>(2);
-      }
-   };
+   private static final Collection<JoinPointInfo> temp =
+      new HashSet<JoinPointInfo>(2);
     
    public NonOptimizedCalleeSearcher(String calleeExpression)
    {
@@ -98,26 +95,29 @@
    
    public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
    {
-      Collection<JoinPointInfo> temp = TEMP.get();
-      node.searchCallees(calleeExpression, temp);
-      for (JoinPointInfo joinPointInfo: temp)
+      synchronized (temp)
       {
-         if (joinPointInfo instanceof CallerConstructorInfo)
+      
+         node.searchCallees(calleeExpression, temp);
+         for (JoinPointInfo joinPointInfo: temp)
          {
-            if (this.accept(((CallerConstructorInfo) joinPointInfo).getConstructor()))
+            if (joinPointInfo instanceof CallerConstructorInfo)
             {
-               searchResult.add(joinPointInfo);
+               if (this.accept(((CallerConstructorInfo) joinPointInfo).getConstructor()))
+               {
+                  searchResult.add(joinPointInfo);
+               }
             }
-         }
-         else if (joinPointInfo instanceof CallerMethodInfo)
-         {
-            if (this.accept(((CallerMethodInfo) joinPointInfo).getMethod()))
+            else if (joinPointInfo instanceof CallerMethodInfo)
             {
-               searchResult.add(joinPointInfo);
+               if (this.accept(((CallerMethodInfo) joinPointInfo).getMethod()))
+               {
+                  searchResult.add(joinPointInfo);
+               }
             }
          }
+         temp.clear();
       }
-      temp.clear();
    }
    
    protected abstract boolean accept(Method method);
@@ -164,22 +164,70 @@
  */
 class FilteredCalleeRestriction extends NonOptimizedCalleeSearcher
 {
-   private BehaviorFilter behaviourFilter;
+   private static final CalleeWrapper<Constructor> CALLEE_CONSTRUCTOR_WRAPPER =
+      new CalleeWrapper<Constructor>();
+   private static final CalleeWrapper<Method> CALLEE_METHOD_WRAPPER =
+      new CalleeWrapper<Method>();
    
+   private BehaviorFilter behaviorFilter;
+   
    public FilteredCalleeRestriction(String searchExpression, BehaviorFilter filter)
    {
       super(searchExpression);
-      this.behaviourFilter = filter;
+      this.behaviorFilter = filter;
    }
+      
+   protected boolean accept(Constructor constructor)
+   {
+      synchronized(CALLEE_CONSTRUCTOR_WRAPPER)
+      {
+         try
+         {
+            CALLEE_CONSTRUCTOR_WRAPPER.setBehavior(constructor);
+            return behaviorFilter.acceptConstructor(CALLEE_CONSTRUCTOR_WRAPPER);
+         }
+         finally
+         {
+            CALLEE_CONSTRUCTOR_WRAPPER.setBehavior(null);
+         }
+      }
+   }
    
    protected boolean accept(Method method)
    {
-      return behaviourFilter.accept(method);
+      synchronized(CALLEE_METHOD_WRAPPER)
+      {
+         try
+         {
+            CALLEE_METHOD_WRAPPER.setBehavior(method);
+            return behaviorFilter.acceptMethod(CALLEE_METHOD_WRAPPER);
+         }
+         finally
+         {
+            CALLEE_METHOD_WRAPPER.setBehavior(null);
+         }
+      }
    }
    
-   protected boolean accept(Constructor constructor)
+   private static class CalleeWrapper<B extends Member> implements BehaviorWrapper<B>
    {
-      return behaviourFilter.accept(constructor);
+      private B behavior;
+      
+      public void setBehavior(B behavior)
+      {
+         this.behavior = behavior;
+      }
+      
+      public B getBehavior()
+      {
+         return behavior;
+      }
+
+      public Advisor getMetaDataContainer()
+      {
+         return AspectManager.instance().getTempClassAdvisorIfNotExist(
+               behavior.getDeclaringClass());
+      }
    }
 }
 
@@ -189,35 +237,33 @@
  *  
  * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
  */
-class AttExcFilteredCalleeRestriction extends NonOptimizedCalleeSearcher
+class AttExcFilteredCalleeRestriction extends FilteredCalleeRestriction
 {
    private Collection<ASTAttribute> attributes;
    private Collection<ASTException> exceptions;
-   private BehaviorFilter behaviourFilter;
    
    public AttExcFilteredCalleeRestriction(String searchExpression,
          Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
-         BehaviorFilter behaviourFilter)
+         BehaviorFilter behaviorFilter)
    {
-      super(searchExpression);
+      super(searchExpression, behaviorFilter);
       this.attributes = attributes;
       this.exceptions = exceptions;
-      this.behaviourFilter = behaviourFilter;
    }
    
+   protected boolean accept(Constructor constructor)
+   {
+      return Util.matchModifiers(attributes, constructor.getModifiers()) &&
+         Util.matchExceptions(exceptions, constructor.getExceptionTypes()) &&
+         super.accept(constructor);
+   }
+   
    protected boolean accept(Method method)
    {
       return Util.matchModifiers(attributes, method.getModifiers()) &&
          Util.matchExceptions(exceptions, method.getExceptionTypes()) &&
-         behaviourFilter.accept(method);
+         super.accept(method);
    }
-   
-   protected boolean accept(Constructor constructor)
-   {
-      return Util.matchModifiers(attributes, constructor.getModifiers()) &&
-         Util.matchExceptions(exceptions, constructor.getExceptionTypes()) &&
-         behaviourFilter.accept(constructor);
-   }
 }
 
 /**

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -21,9 +21,6 @@
  */
 package org.jboss.aop.joinpoint.graph;
 
-import java.lang.reflect.Field;
-
-import org.jboss.aop.AspectManager;
 import org.jboss.aop.pointcut.Util;
 import org.jboss.aop.pointcut.ast.ClassExpression;
 
@@ -37,10 +34,10 @@
    /**
     * Tests whether or not {@code field} is accepted or rejected by this filter.
     * 
-    * @param field the field to be tested
-    * @return      {@code boolean} if this filter accepts {@code field}
+    * @param field represents the field to be tested
+    * @return      {@code true} if this filter accepts {@code field}
     */
-   public boolean accept(Field field);
+   public boolean accept(FieldNode field);
 }
 
 /**
@@ -64,9 +61,9 @@
       this.classExpression = classExpression;
    }
 
-   public boolean accept(Field field)
+   public boolean accept(FieldNode fieldNode)
    {
-      return Util.matchesClassExpr(classExpression, field.getType(),
-            AspectManager.instance().getTempClassAdvisorIfNotExist(field.getType()));
+      return Util.matchesClassExpr(classExpression, fieldNode.getField().getType(),
+            fieldNode.getMetaDataContainer());
    }  
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldNode.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldNode.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldNode.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -86,6 +86,11 @@
          names.add(commonPrefix + metaDataTag);
       }
    }
+   
+   public Advisor getMetaDataContainer()
+   {
+      return this.advisor;
+   }
  
    /**
     * Returns the field represented by this node.

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -137,7 +137,7 @@
       {
          Field field = fieldNode.getField();
          if (Util.matchModifiers(attributes, field.getModifiers()) &&
-            (fieldFilter == null || fieldFilter.accept(field)))
+            (fieldFilter == null || fieldFilter.accept(fieldNode)))
          {
             internalSearcher.search(fieldNode, searchResult);
          }

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataAware.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataAware.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataAware.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -0,0 +1,40 @@
+/*
+ * 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.aop.joinpoint.graph;
+
+import org.jboss.aop.Advisor;
+
+/**
+ * Interface that must be implemented by any class that represents a reflection
+ * element with support for meta data (fields, methods, constructors, classes).
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+interface MetaDataAware
+{
+   /**
+   * Returns an advisor that contains meta data
+   * 
+   * @return an advisor that contains meta data
+   */
+  Advisor getMetaDataContainer();
+}
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataKeyLoader.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataKeyLoader.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/MetaDataKeyLoader.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -23,6 +23,8 @@
 
 import java.util.Collection;
 
+import org.jboss.aop.Advisor;
+
 /**
  * Loads meta data keys used to identify an element in a collection.
  * <br>
@@ -31,12 +33,21 @@
  * 
  * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
  */
-interface MetaDataKeyLoader
+interface MetaDataKeyLoader extends MetaDataAware
 {
    /**
-    * Loads indexing metadata keys.
+    * Loads indexing metadata keys using the {@link #getMetaDataContainer() meta data
+    * container} as source.
     * 
     * @param names collection that will hold all loaded meta data keys.
     */
    void loadMetaDataKeys(Collection<String> names);
+   
+   /**
+    * Returns an advisor that contains the meta data. This is the source used by
+    * {@link #loadMetaDataKeys(Collection)}
+    * 
+    * @return an advisor that contains the meta data
+    */
+   Advisor getMetaDataContainer();
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Node.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Node.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Node.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -23,6 +23,8 @@
 
 import java.util.Collection;
 
+import org.jboss.aop.Advisor;
+
 /**
  * A node in the graph.
  * <br>
@@ -62,4 +64,10 @@
     * @param names collection that will hold all loaded meta data keys.
     */
    void loadMetaDataKeys(Collection<String> names);
+   
+   /**
+    * Returns an advisor that contains the meta data associated with the joinpoints
+    * represented by this node.
+    */
+   Advisor getMetaDataContainer();
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -44,8 +44,7 @@
       {
          for (TypeFilter restriction: typeFilters)
          {
-            if (!restriction.accept(classNode.getClazz(),
-                  classNode.getMetaDataContainer()))
+            if (!restriction.accept(classNode))
             {
                continue outer;
             }

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -585,11 +585,11 @@
             if (behaviourFilter != null)
             {
                behaviourFilter = new ConjunctiveBehaviorFilter(behaviourFilter,
-                     new OverridenMethodFilter(identifier));
+                     new ImplementedMethodFilter(identifier));
             }
             else
             {
-               behaviourFilter = new OverridenMethodFilter(identifier);
+               behaviourFilter = new ImplementedMethodFilter(identifier);
             }
       }
       
@@ -691,7 +691,7 @@
                beforeWildcardFilter = filter;
                filter = null;
             }
-            // add the wildard to the expression
+            // add the wildcard to the expression
             expression.append('*');
          }
          // no wildcard

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeFilter.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeFilter.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeFilter.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -21,7 +21,6 @@
  */
 package org.jboss.aop.joinpoint.graph;
 
-import org.jboss.aop.Advisor;
 import org.jboss.aop.pointcut.Typedef;
 import org.jboss.aop.pointcut.Util;
 import org.jboss.aop.pointcut.ast.ASTConstructor;
@@ -39,10 +38,10 @@
    /**
     * Tests whether or not {@code type} is accepted or rejected by this filter.
     * 
-    * @param type the type to be tested
+    * @param type represents the type to be tested
     * @return     {@code true} if this filter accepts {@code type}
     */
-   public boolean accept(Class type, Advisor advisor);
+   public boolean accept(ClassNode type);
 }
 
 
@@ -68,10 +67,10 @@
       this.typeRestriction2 = typeRestriction2;
    }
    
-   public boolean accept(Class target, Advisor advisor)
+   public boolean accept(ClassNode type)
    {
-      return typeRestriction1.accept(target, advisor) ||
-         typeRestriction2.accept(target, advisor);
+      return typeRestriction1.accept(type) ||
+         typeRestriction2.accept(type);
    }
 }
 
@@ -96,9 +95,9 @@
       this.typeFilter = typeFilter;
    }
    
-   public boolean accept(Class type, Advisor advisor)
+   public boolean accept(ClassNode type)
    {
-      return !typeFilter.accept(type, advisor);
+      return !typeFilter.accept(type);
    }
 }
 
@@ -122,13 +121,15 @@
       this.astBehavior = astBehavior;
    }
    
-   public boolean accept(Class target, Advisor advisor)
+   public boolean accept(ClassNode type)
    {
       if (astBehavior instanceof ASTConstructor)
       {
-         return Util.has(target, (ASTConstructor) astBehavior, advisor);
+         return Util.has(type.getClazz(), (ASTConstructor) astBehavior,
+               type.getMetaDataContainer());
       }
-      return Util.has(target, (ASTMethod) astBehavior, advisor);
+      return Util.has(type.getClazz(), (ASTMethod) astBehavior,
+            type.getMetaDataContainer());
    }
 }
 
@@ -153,9 +154,9 @@
       this.astField = astField;
    }
    
-   public boolean accept(Class target, Advisor advisor)
+   public boolean accept(ClassNode type)
    {
-      return Util.has(target, astField, advisor);
+      return Util.has(type.getClazz(), astField, type.getMetaDataContainer());
    }
 }
 
@@ -178,8 +179,8 @@
       this.typedef = typedef;
    }
 
-   public boolean accept(Class target, Advisor advisor)
+   public boolean accept(ClassNode type)
    {
-      return typedef.matches(advisor, target);
+      return typedef.matches(type.getMetaDataContainer(), type.getClazz());
    }
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AllTests.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AllTests.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AllTests.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -43,6 +43,9 @@
       suite.addTestSuite(CompositeDomainDataTest.class);
       suite.addTestSuite(ClassNodeTest.class);
       suite.addTestSuite(GraphInsertionTest.class);
+      suite.addTestSuite(FieldFilterTest.class);
+      suite.addTestSuite(BehaviorFilterTest.class);
+      suite.addTestSuite(TypeFilterTest.class);
       //suite.addTest(org.jboss.aop.joinpoint.graph.tree.AllTests.suite());
       //$JUnit-END$
       return suite;

Added: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AnnPojo.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AnnPojo.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/AnnPojo.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -0,0 +1,149 @@
+/*
+ * 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.aop.joinpoint.graph;
+
+/**
+ * Test scenario.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+ at SuppressWarnings("deprecation")
+class AnnPojo
+{
+   public AnnPojo(Pojo2 arg1, AnyAnnotationPojo arg2,
+         DummyAnnotationPojo arg3) {}
+   
+   public AnnPojo(int arg1, Pojo2 arg2, long arg3, DummyAnnotationPojo arg4) {}
+   
+   public AnnPojo(Pojo2 arg1, DummyAnnotationPojo arg2, long arg3) {}
+   
+   public AnnPojo(Pojo2 arg1, int arg2, long arg3) {}
+   
+   public AnnPojo(String arg1, int arg2, long arg3, DummyAnnotationPojo arg4,
+         AnyAnnotationPojo arg5){}
+   
+   public AnnPojo(DummyAnnotationPojo arg1, AnyAnnotationPojo arg2) {}
+   
+   public AnnPojo(AnyAnnotationPojo arg1){}
+   
+   public void method1(Pojo2 arg1, AnyAnnotationPojo arg2,
+         DummyAnnotationPojo arg3){}
+   
+   public Pojo2 method2(int arg1, Pojo2 arg2, long arg3, DummyAnnotationPojo arg4)
+   {
+      return null;
+   }
+   
+   public DummyAnnotationPojo method3(Pojo2 arg1, DummyAnnotationPojo arg2, long arg3)
+   {
+      return null;
+   }
+   
+   public void method4(Pojo2 arg1, int arg2, long arg3) {}
+   
+   public String method5(String arg1, int arg2, long arg3, DummyAnnotationPojo arg4,
+         AnyAnnotationPojo arg5)
+   {
+      return arg1;
+   }
+   
+   public void method6(DummyAnnotationPojo arg1, AnyAnnotationPojo arg2) {}
+   
+   public AnyAnnotationPojo method7(AnyAnnotationPojo arg1)
+   {
+      return arg1;
+   }
+}
+
+/**
+ * Test scenario.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+ at AnyAnnotation
+abstract class AnyAnnotationPojo implements DummyInterface
+{
+   public AnyAnnotationPojo(int arg) {}
+   public void method1() {}
+   public void method2() {}
+}
+
+/**
+ * Test scenario.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+ at DummyAnnotation
+class DummyAnnotationPojo implements DummyInterface
+{
+   public void method() {}
+   public void interfaceMethod() {}
+   public DummyAnnotationPojo interfaceMethod2()
+   {
+      return null;
+   }
+}
+
+/**
+ * Test scenario.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+interface DummyInterface extends DummyInterface2
+{
+   void interfaceMethod();
+}
+
+/**
+ * Test scenario.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+interface DummyInterface2
+{
+   DummyAnnotationPojo interfaceMethod2();
+}
+
+/**
+ * Test scenario.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+ at DummyAnnotation
+class DummyAnnotationPojo2 extends AnyAnnotationPojo
+{
+   public DummyAnnotationPojo2(DummyInterface2 arg)
+   {
+      super(0);
+   }
+   
+   @Override
+   public void method1() {}
+   
+   public void method2(int arg) {}
+   
+   public void interfaceMethod() {}
+   public DummyAnnotationPojo interfaceMethod2()
+   {
+      return null;
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/BehaviorFilterTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/BehaviorFilterTest.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/BehaviorFilterTest.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -0,0 +1,518 @@
+/*
+ * 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.aop.joinpoint.graph;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.pointcut.Typedef;
+import org.jboss.aop.pointcut.TypedefExpression;
+import org.jboss.aop.pointcut.ast.ASTConstructor;
+import org.jboss.aop.pointcut.ast.ASTMethod;
+import org.jboss.aop.pointcut.ast.ASTParameter;
+import org.jboss.aop.pointcut.ast.ClassExpression;
+import org.jboss.aop.pointcut.ast.IdentifierExpression;
+
+/**
+ * Tests {@code BehaviorFilter}. 
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class BehaviorFilterTest extends TestCase
+{
+   private BehaviorWrapper<Constructor>[] consWrappers;
+   private BehaviorWrapper<Method>[] methodWrappers;
+   
+   @SuppressWarnings("all")
+   public void setUp() throws Exception
+   {
+      consWrappers = (BehaviorWrapper<Constructor>[]) new BehaviorWrapper[9];
+      consWrappers[0] = new BehaviorWrapperImpl<Constructor>(AnnPojo.class.
+            getDeclaredConstructor(Pojo2.class, AnyAnnotationPojo.class,
+                  DummyAnnotationPojo.class));
+      consWrappers[1] = new BehaviorWrapperImpl<Constructor>(AnnPojo.class.
+            getDeclaredConstructor(int.class, Pojo2.class, long.class,
+                  DummyAnnotationPojo.class));
+      consWrappers[2] = new BehaviorWrapperImpl<Constructor>(AnnPojo.class.
+            getDeclaredConstructor(Pojo2.class, DummyAnnotationPojo.class,
+                  long.class));
+      consWrappers[3] = new BehaviorWrapperImpl<Constructor>(AnnPojo.class.
+            getDeclaredConstructor(Pojo2.class, int.class, long.class));
+      consWrappers[4] = new BehaviorWrapperImpl<Constructor>(AnnPojo.class.
+            getDeclaredConstructor(String.class, int.class, long.class,
+                  DummyAnnotationPojo.class, AnyAnnotationPojo.class));
+      consWrappers[5] = new BehaviorWrapperImpl<Constructor>(AnnPojo.class.
+            getDeclaredConstructor(DummyAnnotationPojo.class,
+                  AnyAnnotationPojo.class));
+      consWrappers[6] = new BehaviorWrapperImpl<Constructor>(AnnPojo.class.
+            getDeclaredConstructor(AnyAnnotationPojo.class));
+      consWrappers[7] = new BehaviorWrapperImpl<Constructor>(AnyAnnotationPojo.class.
+            getDeclaredConstructor(int.class));
+      consWrappers[8] = new BehaviorWrapperImpl<Constructor>(DummyAnnotationPojo2.class.
+            getDeclaredConstructor(DummyInterface2.class));
+      
+      methodWrappers = (BehaviorWrapper<Method>[]) new BehaviorWrapper[16];
+      methodWrappers[0] = new BehaviorWrapperImpl<Method>(AnnPojo.class.
+            getDeclaredMethod("method1", Pojo2.class, AnyAnnotationPojo.class,
+                  DummyAnnotationPojo.class));
+      methodWrappers[1] = new BehaviorWrapperImpl<Method>(AnnPojo.class.
+            getDeclaredMethod("method2", int.class, Pojo2.class, long.class,
+                  DummyAnnotationPojo.class));
+      methodWrappers[2] = new BehaviorWrapperImpl<Method>(AnnPojo.class.
+            getDeclaredMethod("method3", Pojo2.class, DummyAnnotationPojo.class,
+                  long.class));
+      methodWrappers[3] = new BehaviorWrapperImpl<Method>(AnnPojo.class.
+            getDeclaredMethod("method4", Pojo2.class, int.class, long.class));
+      methodWrappers[4] = new BehaviorWrapperImpl<Method>(AnnPojo.class.
+            getDeclaredMethod("method5", String.class, int.class, long.class,
+                  DummyAnnotationPojo.class, AnyAnnotationPojo.class));
+      methodWrappers[5] = new BehaviorWrapperImpl<Method>(AnnPojo.class.
+            getDeclaredMethod("method6", DummyAnnotationPojo.class,
+                  AnyAnnotationPojo.class));
+      methodWrappers[6] = new BehaviorWrapperImpl<Method>(AnnPojo.class.
+            getDeclaredMethod("method7", AnyAnnotationPojo.class));
+      methodWrappers[7] = new BehaviorWrapperImpl<Method>(
+            AnyAnnotationPojo.class.getDeclaredMethod("method1"));
+      methodWrappers[8] = new BehaviorWrapperImpl<Method>(
+            AnyAnnotationPojo.class.getDeclaredMethod("method2"));
+      methodWrappers[9] = new BehaviorWrapperImpl<Method>(
+            DummyAnnotationPojo.class.getDeclaredMethod("method"));
+      methodWrappers[10] = new BehaviorWrapperImpl<Method>(
+            DummyAnnotationPojo.class.getDeclaredMethod("interfaceMethod"));
+      methodWrappers[11] = new BehaviorWrapperImpl<Method>(
+            DummyAnnotationPojo.class.getDeclaredMethod("interfaceMethod2"));
+      methodWrappers[12] = new BehaviorWrapperImpl<Method>(
+            DummyAnnotationPojo2.class.getDeclaredMethod("method1"));
+      methodWrappers[13] = new BehaviorWrapperImpl<Method>(
+            DummyAnnotationPojo2.class.getDeclaredMethod("method2", int.class));
+      methodWrappers[14] = new BehaviorWrapperImpl<Method>(
+            DummyAnnotationPojo2.class.getDeclaredMethod("interfaceMethod"));
+      methodWrappers[15] = new BehaviorWrapperImpl<Method>(
+            DummyAnnotationPojo2.class.getDeclaredMethod("interfaceMethod2"));
+   }
+
+   public void testConjunctiveFilter1()
+   {
+      ASTParameter parameter1 = new ASTParameter(1001);
+      ASTParameter parameter2 = new ASTParameter(1001);
+      ASTParameter parameter3 = new ASTParameter(1001);
+      parameter1.setTypeExpression("..");
+      parameter2.setTypeExpression('@' + Deprecated.class.getName());
+      parameter3.setTypeExpression("..");
+      // constructor
+      ASTConstructor constructor = new ASTConstructor(null, 1000);
+      constructor.jjtAddChild(parameter3, 0);
+      constructor.jjtAddChild(parameter2, 0);
+      constructor.jjtAddChild(parameter1, 0);
+      BehaviorFilter filter1 = new FullParameterFilter(constructor);
+      parameter1 = new ASTParameter(1001);
+      parameter2 = new ASTParameter(1001);
+      parameter3 = new ASTParameter(1001);
+      parameter1.setTypeExpression("..");
+      parameter2.setTypeExpression('@' + AnyAnnotation.class.getName());
+      parameter3.setTypeExpression("..");
+      // constructor
+      constructor = new ASTConstructor(null, 1000);
+      constructor.jjtAddChild(parameter3, 0);
+      constructor.jjtAddChild(parameter2, 0);
+      constructor.jjtAddChild(parameter1, 0);
+      BehaviorFilter filter2 = new FullParameterFilter(constructor);
+      BehaviorFilter filter = new ConjunctiveBehaviorFilter(filter1, filter2);
+      assertConstructorFilter(filter, 0, true, false, false, false, false, false,
+            false, false, false);
+   }
+   
+   public void testConjunctiveFilter2()
+   {
+      BehaviorFilter filter1 = new ReturnTypeFilter(new ClassExpression("@" +
+            DummyAnnotation.class.getName()));
+      BehaviorFilter filter2 = new TargetTypeFilter(new ClassExpression(
+            "$instanceof{"+ DummyInterface.class.getName() + "}"));
+      BehaviorFilter filter = new ConjunctiveBehaviorFilter(filter1, filter2);
+      assertMethodFilter(filter, 0, false, false, false, false, false, false, false,
+            false, false, false, false, true, false, false, false, true);
+      
+   }
+   
+   public void testConjunctiveFilter3() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("ComplexExp", "class(@" +
+            DummyAnnotation.class.getName() + ") OR has(int *->length()) OR" +
+                  "class($instanceof{@" + AnyAnnotation.class.getName() + "})");
+      AspectManager.instance().addTypedef(typedef);
+      BehaviorFilter filter1 = new ReturnTypeFilter(new ClassExpression(
+            "$typedef{ComplexExp}"));
+      BehaviorFilter filter2 = new TargetTypeFilter(new ClassExpression(
+            DummyAnnotation.class.getPackage().getName() + ".*Pojo"));
+      PartialParameterFilter filter3 = new AscendingPartialParameterFilter(1);
+      filter3.addParameterRestriction(new ClassExpression("$typedef{ComplexExp}"), 0);
+      BehaviorFilter subFilter = new ConjunctiveBehaviorFilter(filter1, filter2);
+      BehaviorFilter filter = new ConjunctiveBehaviorFilter(subFilter, filter3);
+      assertMethodFilter(filter, 1, false, false, false, false, true, false, true,
+            false, false, false, false, false, false, false, false, false);
+   }
+   
+   public void testReturnTypeFilter1()
+   {
+      ClassExpression exp = new ClassExpression("@" + Deprecated.class.getName());
+      BehaviorFilter filter = new ReturnTypeFilter(exp);
+      assertMethodFilter(filter, 0, false, true, false, false, false, false, false,
+            false, false, false, false, false, false, false, false, false);
+   }
+   
+   public void testReturnTypeFilter2() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("DummyPojo", "class(@" +
+            DummyAnnotation.class.getName() + ") AND has(* *->method(..))");
+      AspectManager.instance().addTypedef(typedef);
+      ClassExpression exp = new ClassExpression("$typedef{DummyPojo}");
+      BehaviorFilter filter = new ReturnTypeFilter(exp);
+      assertMethodFilter(filter, 0, false, false, true, false, false, false, false,
+            false, false, false, false, true, false, false, false, true);
+   }
+   
+   public void testTargetTypeFilter1()
+   {
+      ClassExpression exp = new ClassExpression("@" + AnyAnnotation.class.getName());
+      BehaviorFilter filter = new TargetTypeFilter(exp);
+      assertConstructorFilter(filter, 0, false, false, false, false, false, false,
+            false, true, false);
+      assertMethodFilter(filter, 0, false, false, false, false, false, false, false,
+            true, true, false, false, false, false, false, false, false);
+   }
+   
+   public void testTargetTypeFilter2()
+   {
+      ClassExpression exp = new ClassExpression("@" + DummyAnnotation.class.getName());
+      BehaviorFilter filter = new TargetTypeFilter(exp);
+      assertConstructorFilter(filter, 0, false, false, false, false, false, false,
+            false, false, true);
+      assertMethodFilter(filter, 0, false, false, false, false, false, false, false,
+            false, false, true, true, true, true, true, true, true);
+   }
+   
+   public void testTargetTypeFilter3() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("hasMethod2", "has(* *->method2(..))");
+      AspectManager.instance().addTypedef(typedef);
+      ClassExpression classExpr = new ClassExpression("$typedef{hasMethod2}");
+      BehaviorFilter filter = new TargetTypeFilter(classExpr);
+      assertConstructorFilter(filter, 0, true, true, true, true, true, true, true,
+            true, true);
+      assertMethodFilter(filter, 0, true, true, true, true, true, true, true, true,
+            true, false, false, false, true, true, true, true);
+   }
+   
+   public void testImplementedMethodFilter1()
+   {
+      IdentifierExpression exp = new IdentifierExpression("$implements{" +
+            DummyInterface.class.getName() + "}");
+      BehaviorFilter filter = new ImplementedMethodFilter(exp);
+      assertMethodFilter(filter, 0, false, false, false, false, false, false, false,
+            false, false, false, true, false, false, false, true, false);
+   }
+   
+   public void testImplementedMethodFilter2()
+   {
+      IdentifierExpression exp = new IdentifierExpression("$implementing{" +
+            DummyInterface.class.getName() + "}");
+      BehaviorFilter filter = new ImplementedMethodFilter(exp);
+      assertMethodFilter(filter, 0, false, false, false, false, false, false, false,
+            false, false, false, true, true, false, false, true, true);
+   }
+   
+   public void testImplementedMethodFilter3()
+   {
+      IdentifierExpression exp = new IdentifierExpression("$implements{@" +
+            AnyAnnotation.class.getName() + "}");
+      BehaviorFilter filter = new ImplementedMethodFilter(exp);
+      assertMethodFilter(filter, 0, false, false, false, false, false, false, false,
+            true, true, false, false, false, true, false, false, false);
+   }
+   
+   public void testFullParameterFilter1()
+   {
+      ASTParameter parameter1 = new ASTParameter(1001);
+      ASTParameter parameter2 = new ASTParameter(1001);
+      ASTParameter parameter3 = new ASTParameter(1001);
+      parameter1.setTypeExpression('@' + Deprecated.class.getName());
+      parameter2.setTypeExpression("..");
+      parameter3.setTypeExpression('@' + DummyAnnotation.class.getName());
+      // constructor
+      ASTConstructor constructor = new ASTConstructor(null, 1000);
+      constructor.jjtAddChild(parameter3, 0);
+      constructor.jjtAddChild(parameter2, 1);
+      constructor.jjtAddChild(parameter1, 2);
+      BehaviorFilter filter = new FullParameterFilter(constructor);
+      assertConstructorFilter(filter, 0, true, false, false, false, false, false,
+            false, false, false);
+      // method
+      ASTMethod method = new ASTMethod(null, 1000);
+      method.jjtAddChild(parameter3, 0);
+      method.jjtAddChild(parameter2, 1);
+      method.jjtAddChild(parameter1, 2);
+      filter = new FullParameterFilter(method);
+      assertMethodFilter(filter, 0, true, false, false, false, false, false, false,
+            false, false, false, false, false, false, false, false, false);
+   }
+   
+   public void testFullParameterFilter2()
+   {
+      ASTParameter parameter1 = new ASTParameter(1001);
+      ASTParameter parameter2 = new ASTParameter(1001);
+      ASTParameter parameter3 = new ASTParameter(1001);
+      ASTParameter parameter4 = new ASTParameter(1001);
+      parameter1.setTypeExpression('@' + Deprecated.class.getName());
+      parameter2.setTypeExpression("..");
+      parameter3.setTypeExpression('@' + DummyAnnotation.class.getName());
+      parameter4.setTypeExpression("..");
+      // constructor
+      ASTConstructor constructor = new ASTConstructor(null, 1000);
+      constructor.jjtAddChild(parameter4, 0);
+      constructor.jjtAddChild(parameter3, 0);
+      constructor.jjtAddChild(parameter2, 1);
+      constructor.jjtAddChild(parameter1, 2);
+      BehaviorFilter filter = new FullParameterFilter(constructor);
+      assertConstructorFilter(filter, 0, true, false, true, false, false, false,
+            false, false, false);
+      // method
+      ASTMethod method = new ASTMethod(null, 1000);
+      method.jjtAddChild(parameter4, 0);
+      method.jjtAddChild(parameter3, 0);
+      method.jjtAddChild(parameter2, 1);
+      method.jjtAddChild(parameter1, 2);
+      filter = new FullParameterFilter(method);
+      assertMethodFilter(filter, 0, true, false, true, false, false, false, false,
+            false, false, false, false, false, false, false, false, false);
+   }
+   
+   public void testFullParameterFilter3()
+   {
+      ASTParameter parameter1 = new ASTParameter(1001);
+      ASTParameter parameter2 = new ASTParameter(1001);
+      ASTParameter parameter3 = new ASTParameter(1001);
+      ASTParameter parameter4 = new ASTParameter(1001);
+      ASTParameter parameter5 = new ASTParameter(1001);
+      parameter1.setTypeExpression("..");
+      parameter2.setTypeExpression('@' + Deprecated.class.getName());
+      parameter3.setTypeExpression("..");
+      parameter4.setTypeExpression('@' + DummyAnnotation.class.getName());
+      parameter5.setTypeExpression("..");
+      // constructor
+      ASTConstructor constructor = new ASTConstructor(null, 1000);
+      constructor.jjtAddChild(parameter5, 0);
+      constructor.jjtAddChild(parameter4, 0);
+      constructor.jjtAddChild(parameter3, 0);
+      constructor.jjtAddChild(parameter2, 1);
+      constructor.jjtAddChild(parameter1, 2);
+      BehaviorFilter filter = new FullParameterFilter(constructor);
+      assertConstructorFilter(filter, 0, true, true, true, false, false, false,
+            false, false, false);
+      // method
+      ASTMethod method = new ASTMethod(null, 1000);
+      method.jjtAddChild(parameter5, 0);
+      method.jjtAddChild(parameter4, 0);
+      method.jjtAddChild(parameter3, 0);
+      method.jjtAddChild(parameter2, 1);
+      method.jjtAddChild(parameter1, 2);
+      filter = new FullParameterFilter(method);
+      assertMethodFilter(filter, 0, true, true, true, false, false, false, false,
+            false, false, false, false, false, false, false, false, false);
+   }
+   
+   public void testAscendingPartialParameterFilter1()
+   {
+      PartialParameterFilter ascendingParamFilter =
+         new AscendingPartialParameterFilter(10);
+      ascendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            Deprecated.class.getName()), 0);
+      assertConstructorFilter(ascendingParamFilter, 1, true, false, true, true,
+            false, false, false, false, false);
+      assertMethodFilter(ascendingParamFilter, 1, true, false, true, true, false,
+            false, false, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   public void testAscendingPartialParameterFilter2()
+   {
+      PartialParameterFilter ascendingParamFilter =
+         new AscendingPartialParameterFilter(2);
+      ascendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            Deprecated.class.getName()), 0);
+      ascendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            AnyAnnotation.class.getName()), 1);
+      assertConstructorFilter(ascendingParamFilter, 2, true, false, false, false,
+            false, false, false, false, false);
+      assertMethodFilter(ascendingParamFilter, 2, true, false, false, false, false,
+            false, false, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   public void testAscendingPartialParameterFilter3()
+   {
+      PartialParameterFilter ascendingParamFilter =
+         new AscendingPartialParameterFilter(2);
+      ascendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            AnyAnnotation.class.getName()), 1);
+      assertConstructorFilter(ascendingParamFilter, 2, true, false, false, false,
+            false, true, false, false, false);
+      assertMethodFilter(ascendingParamFilter, 2, true, false, false, false, false,
+            true, false, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   public void testAscendingPartialParameterFilter4()
+   {
+      PartialParameterFilter ascendingParamFilter =
+         new AscendingPartialParameterFilter(1);
+      ascendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            AnyAnnotation.class.getName()), 0);
+      assertConstructorFilter(ascendingParamFilter, 1, false, false, false, false,
+            false, false, true, false, false);
+      assertMethodFilter(ascendingParamFilter, 1, false, false, false, false, false,
+            false, true, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   public void testDescendingPartialParameterFilter1()
+   {
+      PartialParameterFilter descendingParamFilter =
+         new DescendingPartialParameterFilter(3);
+      descendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            DummyAnnotation.class.getName()), 2);
+      assertConstructorFilter(descendingParamFilter, 3, true, true, false, false,
+            false, false, false, false, false);
+      assertMethodFilter(descendingParamFilter, 3, true, true, false, false, false,
+            false, false, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   public void testDescendingPartialParameterFilter2()
+   {
+      PartialParameterFilter descendingParamFilter =
+         new DescendingPartialParameterFilter(4);
+      descendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            Deprecated.class.getName()), 1);
+      descendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            AnyAnnotation.class.getName()), 3);
+      assertConstructorFilter(descendingParamFilter, 4, false, false, false, false,
+            false, false, false, false, false);
+      assertMethodFilter(descendingParamFilter, 4, false, false, false, false, false,
+            false, false, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   public void testDescendingPartialParameterFilter3()
+   {
+      PartialParameterFilter descendingParamFilter =
+         new DescendingPartialParameterFilter(4);
+      descendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            Deprecated.class.getName()), 1);
+      descendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            DummyAnnotation.class.getName()), 3);
+      assertConstructorFilter(descendingParamFilter, 4, false, true, false, false,
+            false, false, false, false, false);
+      assertMethodFilter(descendingParamFilter, 4, false, true, false, false, false,
+            false, false, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   public void testDescendingPartialParameterFilter4()
+   {
+      PartialParameterFilter descendingParamFilter =
+         new DescendingPartialParameterFilter(1);
+      descendingParamFilter.addParameterRestriction(new ClassExpression("@" +
+            AnyAnnotation.class.getName()), 0);
+      assertConstructorFilter(descendingParamFilter, 1, false, false, false, false,
+            true, true, true, false, false);
+      assertMethodFilter(descendingParamFilter, 1, false, false, false, false, true,
+            true, true, false, false, false, false, false, false, false, false,
+            false);
+   }
+   
+   private void assertConstructorFilter(BehaviorFilter filter, int minSize,
+         boolean... accepts)
+   {
+      assertEquals(consWrappers.length, accepts.length);
+      for (int i = 0; i < accepts.length; i++)
+      {
+         Constructor constructor = consWrappers[i].getBehavior();
+         if (constructor.getParameterTypes().length < minSize)
+         {
+            assertFalse("Constructor " + constructor + " expected to have a minimum of " +
+                  minSize + " parameter(s)", accepts[i]);
+         }
+         else
+         {
+            assertEquals("Filter " + (accepts[i]? "does not accept ": "accepts ") +
+               consWrappers[i].getBehavior(), accepts[i],
+               filter.acceptConstructor(consWrappers[i]));
+         }
+      }
+   }
+   
+   private void assertMethodFilter(BehaviorFilter filter, int minSize,
+         boolean... accepts)
+   {
+      assertEquals(methodWrappers.length, accepts.length);
+      for (int i = 0; i < accepts.length; i++)
+      {
+         Method method = methodWrappers[i].getBehavior();
+         if (method.getParameterTypes().length < minSize)
+         {
+            assertFalse("Method " + method + " expected to have a minimum of " +
+                  minSize + " parameter(s)", accepts[i]);
+         }
+         else
+         {
+            assertEquals("Filter " + (accepts[i]? "does not accept ": "accepts ") +
+               method, accepts[i], filter.acceptMethod(methodWrappers[i]));
+         }
+      }
+   }
+   
+   static class BehaviorWrapperImpl<B extends Member> implements BehaviorWrapper<B>
+   {
+      private B behavior;
+      
+      public BehaviorWrapperImpl(B behavior)
+      {
+         this.behavior = behavior;
+      }
+      
+      public B getBehavior()
+      {
+         return this.behavior;
+      }
+      
+      public Advisor getMetaDataContainer()
+      {
+         return AspectManager.instance().getTempClassAdvisorIfNotExist(
+               behavior.getDeclaringClass());
+      }
+   }
+}
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/FieldFilterTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/FieldFilterTest.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/FieldFilterTest.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -21,8 +21,6 @@
  */
 package org.jboss.aop.joinpoint.graph;
 
-import java.lang.reflect.Field;
-
 import junit.framework.TestCase;
 
 import org.jboss.aop.AspectManager;
@@ -37,23 +35,30 @@
  */
 public class FieldFilterTest extends TestCase
 {
-   private Field field1;
-   private Field field2;
-   private Field field3;
-   private Field field4;
-   private Field field5;
-   private Field field6;
+   private FieldNode[] fieldNodes;
    
    @SuppressWarnings("deprecation")
    public void setUp() throws Exception
    {
-      field1 = Pojo1.class.getDeclaredField("field");
-      field2 = Pojo2.class.getDeclaredField("pojo3");
-      field3 = Pojo3.class.getDeclaredField("intField");
-      field4 = Pojo3.class.getDeclaredField("dumbField");
-      field5 = Pojo3.class.getDeclaredField("ANY_CONSTANT");
-      field6 = Pojo3.class.getDeclaredField("field");
-      
+      fieldNodes = new FieldNode[6];
+      fieldNodes[0] = new FieldNode(AspectManager.instance().
+            getTempClassAdvisorIfNotExist(Pojo1.class),
+            Pojo1.class.getDeclaredField("field"));
+      fieldNodes[1] = new FieldNode(AspectManager.instance().
+            getTempClassAdvisorIfNotExist(Pojo2.class),
+            Pojo2.class.getDeclaredField("pojo3"));
+      fieldNodes[2] = new FieldNode(AspectManager.instance().
+            getTempClassAdvisorIfNotExist(Pojo3.class),
+            Pojo3.class.getDeclaredField("intField"));
+      fieldNodes[3] = new FieldNode(AspectManager.instance().
+            getTempClassAdvisorIfNotExist(Pojo3.class),
+            Pojo3.class.getDeclaredField("dumbField"));
+      fieldNodes[4] = new FieldNode(AspectManager.instance().
+            getTempClassAdvisorIfNotExist(Pojo3.class),
+            Pojo3.class.getDeclaredField("ANY_CONSTANT"));
+      fieldNodes[5] = new FieldNode(AspectManager.instance().
+            getTempClassAdvisorIfNotExist(Pojo3.class),
+            Pojo3.class.getDeclaredField("field"));
    }
    
    public void test1() throws Exception
@@ -90,20 +95,13 @@
       assertFilter(fieldFilter, true, false, false, true, false, true);
    }
    
-   private void assertFilter(FieldFilter filter, boolean accept1, boolean accept2,
-         boolean accept3, boolean accept4, boolean accept5, boolean accept6)
+   private void assertFilter(FieldFilter filter, boolean... accepts)
    {
-      assertEquals("Filter " + (accept1? "does not accept ": "accepts ") + field1,
-            accept1, filter.accept(field1));
-      assertEquals("Filter " + (accept2? "does not accept ": "accepts ") + field2,
-            accept2, filter.accept(field2));
-      assertEquals("Filter " + (accept3? "does not accept ": "accepts ") + field3,
-            accept3, filter.accept(field3));
-      assertEquals("Filter " + (accept4? "does not accept ": "accepts ") + field4,
-            accept4, filter.accept(field4));
-      assertEquals("Filter " + (accept5? "does not accept ": "accepts ") + field5,
-            accept5, filter.accept(field5));
-      assertEquals("Filter " + (accept6? "does not accept ": "accepts ") + field6,
-            accept6, filter.accept(field6));
+      assertEquals(fieldNodes.length, accepts.length);
+      for (int i = 0; i < accepts.length; i++)
+      {
+         assertEquals("Filter " + (accepts[i]? "does not accept ": "accepts ") +
+               fieldNodes[i], accepts[i], filter.accept(fieldNodes[i]));
+      }
    }
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/Pojo5.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/Pojo5.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/Pojo5.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -21,6 +21,16 @@
  */
 package org.jboss.aop.joinpoint.graph;
 
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.util.Collection;
 
 import org.jboss.aop.Aspect;
@@ -51,4 +61,6 @@
    public void calledByMethod() {}
 }
 
+ at Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
+ at Retention(RetentionPolicy.RUNTIME)
 @interface AnyAnnotation {}
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/TypeFilterTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/TypeFilterTest.java	2008-07-04 14:34:26 UTC (rev 75392)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/TypeFilterTest.java	2008-07-04 14:49:13 UTC (rev 75393)
@@ -22,11 +22,11 @@
 package org.jboss.aop.joinpoint.graph;
 
 import java.io.StringReader;
+import java.util.Collection;
 
 import junit.framework.TestCase;
 
 import org.jboss.aop.Aspect;
-import org.jboss.aop.AspectManager;
 import org.jboss.aop.Mixin;
 import org.jboss.aop.pointcut.Typedef;
 import org.jboss.aop.pointcut.TypedefExpression;
@@ -45,6 +45,19 @@
  */
 public class TypeFilterTest extends TestCase
 {
+   ClassNode[] classNodes;
+   
+   @SuppressWarnings("deprecation")
+   public void setUp()
+   {
+      this.classNodes = new ClassNode[5];
+      classNodes[0] = new ClassNodeMock(Pojo1.class);
+      classNodes[1] = new ClassNodeMock(Pojo2.class);
+      classNodes[2] = new ClassNodeMock(Pojo3.class);
+      classNodes[3] = new ClassNodeMock(Pojo4.class);
+      classNodes[4] = new ClassNodeMock(Pojo5.class);
+   }
+   
    public void testHasField1() throws Exception
    {
       ASTField astField = getASTField("* *->field");
@@ -138,27 +151,14 @@
             false, false, true, true);
    }
    
-   @SuppressWarnings("deprecation")
-   private void assertFilter(TypeFilter filter, boolean acceptPojo1,
-         boolean acceptPojo2, boolean acceptPojo3, boolean acceptPojo4,
-         boolean acceptPojo5)
+   private void assertFilter(TypeFilter filter, boolean... acceptPojo)
    {
-
-      assertEquals("Filter " + (acceptPojo1? "does not accept ": "accepts ") +
-            "Pojo1.class", acceptPojo1, filter.accept(Pojo1.class,
-            AspectManager.instance().getTempClassAdvisorIfNotExist(Pojo1.class)));
-      assertEquals("Filter " + (acceptPojo2? "does not accept ": "accepts ") +
-            "Pojo2.class", acceptPojo2, filter.accept(Pojo2.class,
-            AspectManager.instance().getTempClassAdvisorIfNotExist(Pojo2.class)));
-      assertEquals("Filter " + (acceptPojo3? " does not accept ": "accepts ") +
-            "Pojo3.class", acceptPojo3, filter.accept(Pojo3.class,
-            AspectManager.instance().getTempClassAdvisorIfNotExist(Pojo3.class)));
-      assertEquals("Filter " + (acceptPojo4? " does not accept ": "accepts ") +
-            "Pojo4.class", acceptPojo4, filter.accept(Pojo4.class,
-            AspectManager.instance().getTempClassAdvisorIfNotExist(Pojo4.class)));
-      assertEquals("Filter " + (acceptPojo5? " does not accept ": "accepts ") +
-            "Pojo5.class", acceptPojo5, filter.accept(Pojo5.class,
-            AspectManager.instance().getTempClassAdvisorIfNotExist(Pojo5.class)));
+      assertEquals(classNodes.length, acceptPojo.length);
+      for (int i = 0; i < classNodes.length; i++)
+      {
+         assertEquals("Filter " + (acceptPojo[i]? "does not accept ": "accepts ") +
+               "Pojo1.class", acceptPojo[i], filter.accept(classNodes[i]));
+      }
    }
    
    private ASTField getASTField(String fieldExpression) throws ParseException
@@ -204,4 +204,33 @@
       }
       throw new RuntimeException("ASTBehavior not found");
    }
+   
+   private static class ClassNodeMock extends ClassNode
+   {
+      public ClassNodeMock(Class<?> clazz)
+      {
+         super(clazz);
+      }
+
+      @Override
+      public void addSubtype(ClassNode subtype){}
+
+      @Override
+      public Collection<ClassNode> getSubtypes()
+      {
+         return null;
+      }
+
+      @Override
+      public Collection<BehaviorNode> searchBehaviors(String behaviorExpression)
+      {
+         return null;
+      }
+
+      @Override
+      public Collection<FieldNode> searchFields(String fieldExpression)
+      {
+         return null;
+      }
+   }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list