aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/EllipsisTypePattern.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NoTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java5
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java23
13 files changed, 62 insertions, 19 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndTypePattern.java
index 83004d468..e4099a692 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndTypePattern.java
@@ -69,6 +69,11 @@ public class AndTypePattern extends TypePattern {
}
@Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return left.matchesArray(type) && right.matchesArray(type);
+ }
+
+ @Override
public void setIsVarArgs(boolean isVarArgs) {
this.isVarArgs = isVarArgs;
left.setIsVarArgs(isVarArgs);
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyTypePattern.java
index 2f71e7312..4201f3cfb 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyTypePattern.java
@@ -61,6 +61,11 @@ public class AnyTypePattern extends TypePattern {
}
@Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return true;
+ }
+
+ @Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(ANY_KEY);
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java
index eafc0ebc1..f0583ffcf 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java
@@ -83,6 +83,11 @@ public class AnyWithAnnotationTypePattern extends TypePattern {
}
@Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return true;
+ }
+
+ @Override
public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith(
typeVariableMap, w));
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/EllipsisTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/EllipsisTypePattern.java
index 745edb9f1..34df30df5 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/EllipsisTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/EllipsisTypePattern.java
@@ -17,6 +17,7 @@ import java.util.Map;
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 EllipsisTypePattern extends TypePattern {
@@ -60,6 +61,11 @@ public class EllipsisTypePattern extends TypePattern {
}
@Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return false;
+ }
+
+ @Override
public void write(CompressingDataOutputStream s) throws IOException {
s.writeByte(ELLIPSIS_KEY);
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java
index 9cd6ef6e2..6a747a3ec 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java
@@ -177,6 +177,11 @@ public class ExactTypePattern extends TypePattern {
return (typeMatch && annMatch);
}
+ @Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return type.getDimensions() == getDimensions();
+ }
+
public UnresolvedType getType() {
return type;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java
index 84730b900..be09f77ba 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/HasMemberTypePattern.java
@@ -26,6 +26,7 @@ import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
@@ -122,6 +123,11 @@ public class HasMemberTypePattern extends TypePattern {
}
@Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return true;
+ }
+
+ @Override
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
throw new UnsupportedOperationException("hasmethod/field do not support instanceof matching");
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NoTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NoTypePattern.java
index aac64a1d6..585bf34d1 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NoTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NoTypePattern.java
@@ -49,6 +49,11 @@ public class NoTypePattern extends TypePattern {
return false;
}
+ @Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return false;
+ }
+
/**
* @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(ResolvedType)
*/
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java
index dca24c8f3..b5c5aee5a 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java
@@ -69,6 +69,11 @@ public class NotTypePattern extends TypePattern {
}
@Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return !negatedPattern.matchesArray(type);
+ }
+
+ @Override
public boolean matchesStatically(ResolvedType type) {
return !negatedPattern.matchesStatically(type);
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrTypePattern.java
index 4d0f9157f..627c4a7d0 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrTypePattern.java
@@ -73,6 +73,11 @@ public class OrTypePattern extends TypePattern {
return left.matchesExactly(type, annotatedType) || right.matchesExactly(type, annotatedType);
}
+ @Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return left.matchesArray(type) || right.matchesArray(type);
+ }
+
public boolean matchesStatically(ResolvedType type) {
return left.matchesStatically(type) || right.matchesStatically(type);
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java
index 5b2e021c1..4285da575 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java
@@ -465,7 +465,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern {
* Matches on name, declaring type, return type, parameter types, throws types
*/
private FuzzyBoolean matchesExactlyMethod(JoinPointSignature aMethod, World world, boolean subjectMatch) {
- if (aMethod.getReturnType().getDimensions() != returnType.getDimensions()) {
+ if (!returnType.matchesArray(aMethod.getReturnType())) {
return FuzzyBoolean.NO;
}
if (parametersCannotMatch(aMethod)) {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java
index df8345e96..1f98d074a 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java
@@ -68,6 +68,11 @@ public class TypeCategoryTypePattern extends TypePattern {
}
@Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return true;
+ }
+
+ @Override
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
return FuzzyBoolean.fromBoolean(isRightCategory(type));
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java
index 8554e28a1..b0e058d45 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePattern.java
@@ -163,9 +163,7 @@ public abstract class TypePattern extends PatternNode {
protected abstract boolean matchesExactly(ResolvedType type, ResolvedType annotatedType);
- protected boolean matchesArray(ResolvedType type) {
- return type.getDimensions() == getDimensions();
- }
+ protected abstract boolean matchesArray(UnresolvedType type);
protected boolean matchesSubtypes(ResolvedType type) {
// System.out.println("matching: " + this + " to " + type);
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
index 512b72b26..e43b6ca94 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
@@ -233,7 +233,7 @@ public class WildTypePattern extends TypePattern {
// Ensure the annotation pattern is resolved
annotationPattern.resolve(type.getWorld());
- return matchesExactlyByName(targetTypeName, type.isAnonymous(), type.isNested()) && matchesParameters(type, STATIC)
+ return matchesExactlyByName(targetTypeName.replaceFirst("(\\[\\])+$", ""), type.isAnonymous(), type.isNested()) && matchesParameters(type, STATIC)
&& matchesArray(type)
&& matchesBounds(type, STATIC)
&& annotationPattern.matches(annotatedType, type.temporaryAnnotationTypes).alwaysTrue();
@@ -252,6 +252,12 @@ public class WildTypePattern extends TypePattern {
return true;
}
+ @Override
+ protected boolean matchesArray(UnresolvedType type) {
+ return type.getDimensions() == getDimensions() ||
+ getDimensions() == 0 && namePatterns.length > 0 && namePatterns[namePatterns.length-1].toString().endsWith("*");
+ }
+
// we've matched against the base (or raw) type, but if this type pattern specifies bounds because
// it is a ? extends or ? super deal then we have to match them too.
private boolean matchesBounds(ResolvedType aType, MatchKind staticOrDynamic) {
@@ -318,19 +324,6 @@ public class WildTypePattern extends TypePattern {
return innerMatchesExactly(targetTypeName, isAnonymous, isNested);
}
- if (isNamePatternStar()) {
- // we match if the dimensions match
- int numDimensionsInTargetType = 0;
- if (dim > 0) {
- int index;
- while ((index = targetTypeName.indexOf('[')) != -1) {
- numDimensionsInTargetType++;
- targetTypeName = targetTypeName.substring(index + 1);
- }
- return numDimensionsInTargetType == dim;
- }
- }
-
// if our pattern is length 1, then known matches are exact matches
// if it's longer than that, then known matches are prefixes of a sort
if (namePatterns.length == 1) {
@@ -369,7 +362,7 @@ public class WildTypePattern extends TypePattern {
}
}
- return innerMatchesExactly(targetTypeName.substring(0, targetTypeName.length() - dim * 2), isAnonymous, isNested);
+ return innerMatchesExactly(targetTypeName, isAnonymous, isNested);
}
private int lastIndexOfDotOrDollar(String string) {