import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
}
+ @Override
protected boolean couldEverMatchSameTypesAs(TypePattern other) {
return true; // don't dive into ands yet....
}
+ @Override
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
return left.matchesInstanceof(type).and(right.matchesInstanceof(type));
}
+ @Override
protected boolean matchesExactly(ResolvedType type) {
// ??? if these had side-effects, this sort-circuit could be a mistake
return left.matchesExactly(type) && right.matchesExactly(type);
}
+ @Override
protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
return left.matchesExactly(type, annotatedType) && right.matchesExactly(type, annotatedType);
}
+ @Override
public boolean matchesStatically(ResolvedType type) {
return left.matchesStatically(type) && right.matchesStatically(type);
}
+ @Override
public void setIsVarArgs(boolean isVarArgs) {
this.isVarArgs = isVarArgs;
left.setIsVarArgs(isVarArgs);
right.setIsVarArgs(isVarArgs);
}
+ @Override
public void setAnnotationTypePattern(AnnotationTypePattern annPatt) {
if (annPatt == AnnotationTypePattern.ANY) {
return;
}
}
+ @Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(TypePattern.AND);
left.write(s);
return ret;
}
+ @Override
public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
if (requireExactType) {
return notExactType(scope);
right = right.resolveBindings(scope, bindings, false, false);
return this;
}
-
- public TypePattern parameterizeWith(Map typeVariableMap, World w) {
+
+ @Override
+ public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
TypePattern newLeft = left.parameterizeWith(typeVariableMap, w);
TypePattern newRight = right.parameterizeWith(typeVariableMap, w);
AndTypePattern ret = new AndTypePattern(newLeft, newRight);
return ret;
}
+ @Override
public String toString() {
StringBuffer buff = new StringBuffer();
if (annotationPattern != AnnotationTypePattern.ANY) {
return right;
}
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof AndTypePattern)) {
return false;
return left.equals(atp.left) && right.equals(atp.right);
}
+ @Override
public boolean isStarAnnotation() {
return left.isStarAnnotation() && right.isStarAnnotation();
}
*
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
int ret = 17;
ret = ret + 37 * left.hashCode();
return ret;
}
+ @Override
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+ @Override
public Object traverse(PatternNodeVisitor visitor, Object data) {
Object ret = accept(visitor, data);
left.traverse(visitor, ret);
return annotationTypePattern;
}
+ @Override
public int couldMatchKinds() {
return Shadow.ALL_SHADOW_KINDS_BITS;
}
- public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+ @Override
+ public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
AnnotationPointcut ret = new AnnotationPointcut((ExactAnnotationTypePattern) annotationTypePattern.parameterizeWith(
typeVariableMap, w));
ret.copyLocationFrom(this);
*
* @see org.aspectj.weaver.patterns.Pointcut#fastMatch(org.aspectj.weaver.patterns.FastMatchInfo)
*/
+ @Override
public FuzzyBoolean fastMatch(FastMatchInfo info) {
if (info.getKind() == Shadow.StaticInitialization) {
return annotationTypePattern.fastMatches(info.getType());
*
* @see org.aspectj.weaver.patterns.Pointcut#match(org.aspectj.weaver.Shadow)
*/
+ @Override
protected FuzzyBoolean matchInternal(Shadow shadow) {
AnnotatedElement toMatchAgainst = null;
Member member = shadow.getSignature();
* @see org.aspectj.weaver.patterns.Pointcut#resolveBindings(org.aspectj.weaver.patterns.IScope,
* org.aspectj.weaver.patterns.Bindings)
*/
+ @Override
protected void resolveBindings(IScope scope, Bindings bindings) {
if (!scope.getWorld().isInJava5Mode()) {
scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.ATANNOTATION_ONLY_SUPPORTED_AT_JAVA5_LEVEL),
*
* @see org.aspectj.weaver.patterns.Pointcut#concretize1(org.aspectj.weaver.ResolvedType, org.aspectj.weaver.IntMap)
*/
+ @Override
protected Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
ExactAnnotationTypePattern newType = (ExactAnnotationTypePattern) annotationTypePattern.remapAdviceFormals(bindings);
Pointcut ret = new AnnotationPointcut(newType, bindings.getEnclosingAdvice());
return ret;
}
+ @Override
protected Test findResidueInternal(Shadow shadow, ExposedState state) {
if (annotationTypePattern instanceof BindingAnnotationFieldTypePattern) {
if (shadow.getKind() != Shadow.MethodExecution) {
*
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns()
*/
+ @Override
public List<BindingPattern> getBindingAnnotationTypePatterns() {
if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) {
List<BindingPattern> l = new ArrayList<BindingPattern>();
*
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns()
*/
+ @Override
public List<BindingTypePattern> getBindingTypePatterns() {
return Collections.emptyList();
}
*
* @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
*/
+ @Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(Pointcut.ANNOTATION);
annotationTypePattern.write(s);
return ret;
}
+ @Override
public boolean equals(Object other) {
if (!(other instanceof AnnotationPointcut)) {
return false;
return o.annotationTypePattern.equals(this.annotationTypePattern);
}
+ @Override
public int hashCode() {
int result = 17;
result = 37 * result + annotationTypePattern.hashCode();
this.declarationText = buf.toString();
}
+ @Override
public String toString() {
return this.declarationText;
}
+ @Override
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
public class AnyAnnotationTypePattern extends AnnotationTypePattern {
}
@Override
- public AnnotationTypePattern parameterizeWith(Map arg0, World w) {
+ public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
return this;
}
import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
public class AnyTypePattern extends TypePattern {
}
@Override
- public TypePattern parameterizeWith(Map arg0, World w) {
+ public TypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
return this;
}
}
\ No newline at end of file
}
}
+ @Override
public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
throw new BCException("Parameterization not implemented for annotation field binding construct (compiler limitation)");
// UnresolvedType newAnnotationType = annotationType;
// return ret;
}
+ @Override
public int getFormalIndex() {
return formalIndex;
}
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof BindingAnnotationFieldTypePattern)) {
return false;
&& (formalType.equals(btp.formalType));
}
+ @Override
public int hashCode() {
return (annotationType.hashCode() * 37 + formalIndex * 37) + formalType.hashCode();
}
+ @Override
public AnnotationTypePattern remapAdviceFormals(IntMap bindings) {
if (!bindings.hasKey(formalIndex)) {
throw new BCException("Annotation field binding reference must be bound (compiler limitation)");
}
}
+ @Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(AnnotationTypePattern.BINDINGFIELD2);
formalType.write(s); // the type of the field within the annotation
return ret;
}
+ @Override
public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {
// Inheritance irrelevant because @annotation(Anno(x)) only supported at method execution join points (compiler limitation)
// boolean checkSupers = false;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.AnnotationAJ;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
-import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
/**
* Matches an annotation of a given type
}
@Override
- public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+ public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
UnresolvedType newAnnotationType = annotationType;
if (annotationType.isTypeVariableReference()) {
TypeVariableReference t = (TypeVariableReference) annotationType;
String key = t.getTypeVariable().getName();
if (typeVariableMap.containsKey(key)) {
- newAnnotationType = (UnresolvedType) typeVariableMap.get(key);
+ newAnnotationType = typeVariableMap.get(key);
}
} else if (annotationType.isParameterizedType()) {
newAnnotationType = annotationType.parameterize(typeVariableMap);
}
@Override
- public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+ public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
Pointcut ret = new KindedPointcut(kind, signature.parameterizeWith(typeVariableMap, w), munger);
ret.copyLocationFrom(this);
return ret;
import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
public class NoTypePattern extends TypePattern {
}
@Override
- public TypePattern parameterizeWith(Map arg0, World w) {
+ public TypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
return this;
}
}
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Test;
setLocation(pointcut.getSourceContext(), startPos, pointcut.getEnd());
}
+ @Override
public int couldMatchKinds() {
return Shadow.ALL_SHADOW_KINDS_BITS;
}
return body;
}
+ @Override
public FuzzyBoolean fastMatch(FastMatchInfo type) {
return body.fastMatch(type).not();
}
+ @Override
protected FuzzyBoolean matchInternal(Shadow shadow) {
return body.match(shadow).not();
}
+ @Override
public String toString() {
return "!" + body.toString();
}
+ @Override
public boolean equals(Object other) {
if (!(other instanceof NotPointcut)) {
return false;
return o.body.equals(body);
}
+ @Override
public int hashCode() {
return 37 * 23 + body.hashCode();
}
+ @Override
public void resolveBindings(IScope scope, Bindings bindings) {
// Bindings old = bindings.copy();
}
+ @Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(Pointcut.NOT);
body.write(s);
return ret;
}
+ @Override
protected Test findResidueInternal(Shadow shadow, ExposedState state) {
return Test.makeNot(body.findResidue(shadow, state));
}
+ @Override
public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
Pointcut ret = new NotPointcut(body.concretize(inAspect, declaringType, bindings));
ret.copyLocationFrom(this);
return ret;
}
- public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+ @Override
+ public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap, w));
ret.copyLocationFrom(this);
return ret;
}
+ @Override
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+ @Override
public Object traverse(PatternNodeVisitor visitor, Object data) {
Object ret = accept(visitor, data);
this.body.traverse(visitor, ret);
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
}
@Override
- public TypePattern parameterizeWith(Map typeVariableMap, World w) {
+ public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
TypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap, w);
NotTypePattern ret = new NotTypePattern(newNegatedPattern);
ret.copyLocationFrom(this);
* Contributors:
* PARC initial implementation
* ******************************************************************/
-
-
package org.aspectj.weaver.patterns;
import org.aspectj.weaver.IHasPosition;
-
public class ParserException extends RuntimeException {
private IHasPosition token;
}
@Override
- public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+ public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
WildAnnotationTypePattern ret = new WildAnnotationTypePattern(typePattern.parameterizeWith(typeVariableMap, w));
ret.copyLocationFrom(this);
ret.resolved = resolved;