summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-08-18 09:38:01 +0000
committeracolyer <acolyer>2005-08-18 09:38:01 +0000
commit8eb191ad3ca2b5ea9365b9baf0db77c344c10a33 (patch)
treec7aa0e1d97a619cdc9fd0893564f21ed27ca7d8b
parent8ad9eecd63ff70abf68721fb2d6a0e386a42b2b9 (diff)
downloadaspectj-8eb191ad3ca2b5ea9365b9baf0db77c344c10a33.tar.gz
aspectj-8eb191ad3ca2b5ea9365b9baf0db77c344c10a33.zip
force parameterizeWith to be implemented all the way down the hierarchy
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/TypePattern.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java
index 8969cd4ce..fb6f94639 100644
--- a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java
+++ b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java
@@ -15,6 +15,7 @@ package org.aspectj.weaver.patterns;
import java.io.DataOutputStream;
import java.io.IOException;
+import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.Map;
@@ -282,11 +283,8 @@ public abstract class TypePattern extends PatternNode {
/**
* return a version of this type pattern in which all type variable references have been
* replaced by their corresponding entry in the map.
- * Should ultimately be made abstract and all subtypes forced to implement.
*/
- public TypePattern parameterizeWith(Map typeVariableMap) {
- throw new UnsupportedOperationException("add test cases for the sub-type in question and then override this method in it");
- }
+ public abstract TypePattern parameterizeWith(Map typeVariableMap);
public void postRead(ResolvedType enclosingType) {
}
@@ -521,6 +519,10 @@ class AnyTypePattern extends TypePattern {
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+
+ public TypePattern parameterizeWith(Map arg0) {
+ return this;
+ }
}
/**
@@ -553,7 +555,10 @@ class AnyWithAnnotationTypePattern extends TypePattern {
}
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
- return FuzzyBoolean.YES;
+ if (Modifier.isFinal(type.getModifiers())) {
+ return FuzzyBoolean.fromBoolean(matchesExactly(type));
+ }
+ return FuzzyBoolean.MAYBE;
}
protected boolean matchesExactly(Class type) {
@@ -564,6 +569,10 @@ class AnyWithAnnotationTypePattern extends TypePattern {
return FuzzyBoolean.YES;
}
+ public TypePattern parameterizeWith(Map typeVariableMap) {
+ return this;
+ }
+
public void write(DataOutputStream s) throws IOException {
s.writeByte(TypePattern.ANY_WITH_ANNO);
annotationPattern.write(s);
@@ -691,5 +700,9 @@ class NoTypePattern extends TypePattern {
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+
+ public TypePattern parameterizeWith(Map arg0) {
+ return this;
+ }
}