import java.io.IOException;
import java.lang.reflect.Member;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.aspectj.lang.JoinPoint;
ret.copyLocationFrom(this);
return ret;
}
+
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ AndPointcut ret = new AndPointcut(left.parameterizeWith(typeVariableMap),
+ right.parameterizeWith(typeVariableMap));
+ ret.copyLocationFrom(this);
+ return ret;
+ }
public Pointcut getLeft() {
return left;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.aspectj.bridge.IMessage;
return ret;
}
+ // we can't touch "if" methods
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ return this;
+ }
+
// public static Pointcut MatchesNothing = new MatchesNothingPointcut();
// ??? there could possibly be some good optimizations to be done at this point
public static IfPointcut makeIfFalsePointcut(State state) {
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.aspectj.bridge.ISourceLocation;
ret.copyLocationFrom(this);
return ret;
}
+
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ Pointcut ret = new KindedPointcut(kind, signature.parameterizeWith(typeVariableMap), munger );
+ ret.copyLocationFrom(this);
+ return ret;
+ }
public Shadow.Kind getKind() {
return kind;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Member;
+import java.util.Map;
import java.util.Set;
import org.aspectj.lang.JoinPoint;
ret.copyLocationFrom(this);
return ret;
}
+
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap));
+ ret.copyLocationFrom(this);
+ return ret;
+ }
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
import java.io.IOException;
import java.lang.reflect.Member;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.aspectj.lang.JoinPoint;
return ret;
}
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ Pointcut ret = new OrPointcut(left.parameterizeWith(typeVariableMap),
+ right.parameterizeWith(typeVariableMap));
+ ret.copyLocationFrom(this);
+ return ret;
+ }
+
public Pointcut getLeft() {
return left;
}
import java.io.IOException;
import java.lang.reflect.Member;
import java.util.Collections;
+import java.util.Map;
import java.util.Set;
import org.aspectj.lang.JoinPoint;
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ return this;
+ }
}
//public static Pointcut MatchesNothing = new MatchesNothingPointcut();
throw new BCException("expected state: " + state + " got: " + this.state);
}
}
+
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ throw new UnsupportedOperationException("this method needs to be defined in all subtypes and then made abstract when the work is complete");
+ }
}
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
+import java.util.Map;
import java.util.Set;
import org.aspectj.bridge.IMessage;
public String name;
public TypePatternList arguments;
+ /**
+ * if this is non-null then when the pointcut is concretized the result will be parameterized too.
+ */
+ private Map typeVariableMap;
+
//public ResolvedPointcut binding;
public ReferencePointcut(TypePattern onTypeSymbolic, String name, TypePatternList arguments) {
newBindings.copyContext(bindings);
newBindings.pushEnclosingDefinition(pointcutDec);
try {
- return pointcutDec.getPointcut().concretize(searchStart, newBindings);
+ Pointcut ret = pointcutDec.getPointcut();
+ if (typeVariableMap != null) ret = ret.parameterizeWith(typeVariableMap);
+ return ret.concretize(searchStart, newBindings);
} finally {
newBindings.popEnclosingDefinitition();
}
concretizing = false;
}
}
-
+
+ /**
+ * make a version of this pointcut with any refs to typeVariables replaced by their entry in the map.
+ * Tricky thing is, we can't do this at the point in time this method will be called, so we make a
+ * version that will parameterize the pointcut it ultimately resolves to.
+ */
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ ReferencePointcut ret = new ReferencePointcut(onType,name,arguments);
+ ret.onTypeSymbolic = onTypeSymbolic;
+ ret.typeVariableMap = typeVariableMap;
+ return ret;
+ }
+
// We want to keep the original source location, not the reference location
protected boolean shouldCopyLocationForConcretize() {
return false;
import java.io.DataOutputStream;
import java.io.IOException;
+import java.util.Map;
import java.util.Set;
import org.aspectj.lang.JoinPoint;
protected Pointcut concretize1(ResolvedType inAspect, IntMap bindings) {
return null;
}
+
+ public Pointcut parameterizeWith(Map typeVariableMap) {
+ return null;
+ }
protected Test findResidueInternal(Shadow shadow, ExposedState state) {
return null;