summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-05-12 19:29:19 +0000
committeraclement <aclement>2008-05-12 19:29:19 +0000
commitaf8af82f298d169b4d558b0d1fef3ab0d3a1a677 (patch)
tree09f41d5a870420051212b4737d4e27f3ac75a57c
parent03fd688f298c97c25c7ce6f96685944bb96bd245 (diff)
downloadaspectj-af8af82f298d169b4d558b0d1fef3ab0d3a1a677.tar.gz
aspectj-af8af82f298d169b4d558b0d1fef3ab0d3a1a677.zip
bring refactoring up to date.
-rw-r--r--weaver/src/org/aspectj/weaver/TypeVariable.java16
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelField.java8
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java5
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java6
4 files changed, 30 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/TypeVariable.java b/weaver/src/org/aspectj/weaver/TypeVariable.java
index d85d7412d..d5045ecd8 100644
--- a/weaver/src/org/aspectj/weaver/TypeVariable.java
+++ b/weaver/src/org/aspectj/weaver/TypeVariable.java
@@ -215,7 +215,20 @@ public class TypeVariable {
// can match any type in the range of the type variable...
// XXX what about interfaces?
private boolean matchingBounds(TypeVariableReferenceType tvrt) {
- if (tvrt.getUpperBound() != getUpperBound()) return false;
+ if (tvrt.getUpperBound() != getUpperBound()) {
+ UnresolvedType unresolvedCandidateUpperBound = tvrt.getUpperBound();
+ UnresolvedType unresolvedThisUpperBound = getUpperBound();
+ if (unresolvedCandidateUpperBound instanceof ResolvedType && unresolvedThisUpperBound instanceof ResolvedType) {
+ ResolvedType candidateUpperBound = (ResolvedType)unresolvedCandidateUpperBound;
+ ResolvedType thisUpperBound = (ResolvedType)unresolvedThisUpperBound;
+ if (!thisUpperBound.isAssignableFrom(candidateUpperBound)) {
+ return false;
+ }
+ } else {
+ // not right, they shouldnt have been unresolved...
+ return false;
+ }
+ }
if (tvrt.hasLowerBound() != (getLowerBound() != null)) return false;
if (tvrt.hasLowerBound() && tvrt.getLowerBound() != getLowerBound()) return false;
// either we both have bounds, or neither of us have bounds
@@ -379,6 +392,7 @@ public class TypeVariable {
public String getGenericSignature() {
return "T"+name+";";
+// return "T"+getSignature();
}
public String getErasureSignature() {
return getFirstBound().getErasureSignature();
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/org/aspectj/weaver/bcel/BcelField.java
index 5b374d683..34204c55b 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelField.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelField.java
@@ -145,6 +145,14 @@ final class BcelField extends ResolvedMemberImpl {
return annotations;
}
+ public AnnotationX getAnnotationOfType(UnresolvedType ofType) {
+ ensureAnnotationTypesRetrieved();
+ for (int i=0; i<annotations.length; i++) {
+ if (annotations[i].getTypeName().equals(ofType.getName())) return annotations[i];
+ }
+ return null;
+ }
+
private void ensureAnnotationTypesRetrieved() {
if (annotationTypes == null) {
AnnotationGen annos[] = field.getAnnotations();
diff --git a/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
index c00c4a73f..1def36ad7 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
@@ -380,14 +380,15 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
public boolean equals(Object obj) {
if (!(obj instanceof ExactAnnotationTypePattern)) return false;
ExactAnnotationTypePattern other = (ExactAnnotationTypePattern) obj;
- return (other.annotationType.equals(annotationType)) && isForParameterAnnotationMatch()==other.isForParameterAnnotationMatch();
+ return (other.annotationType.equals(annotationType)) && isForParameterAnnotationMatch()==other.isForParameterAnnotationMatch() &&
+ (annotationValues==null?other.annotationValues==null:annotationValues.equals(other.annotationValues));
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
- return annotationType.hashCode()*37+(isForParameterAnnotationMatch()?0:1);
+ return (((annotationType.hashCode())*37+(isForParameterAnnotationMatch()?0:1))*37)+(annotationValues==null?0:annotationValues.hashCode());
}
public String toString() {
diff --git a/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
index 0bbfa1e07..362c1b045 100644
--- a/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
+++ b/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
@@ -344,14 +344,16 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
public boolean equals(Object obj) {
if (!(obj instanceof WildAnnotationTypePattern)) return false;
WildAnnotationTypePattern other = (WildAnnotationTypePattern) obj;
- return other.typePattern.equals(typePattern) && this.isForParameterAnnotationMatch()==other.isForParameterAnnotationMatch();
+ return other.typePattern.equals(typePattern) &&
+ this.isForParameterAnnotationMatch()==other.isForParameterAnnotationMatch() &&
+ (annotationValues==null?other.annotationValues==null:annotationValues.equals(other.annotationValues));
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
- return (17 + 37*typePattern.hashCode())*37+(isForParameterAnnotationMatch()?0:1);
+ return (((17 + 37*typePattern.hashCode())*37+(isForParameterAnnotationMatch()?0:1))*37)+(annotationValues==null?0:annotationValues.hashCode());
}
/* (non-Javadoc)