// only called as part of parameterization....
public void setSignature(Member signature) {
this.signature = signature;
+ // reset hashCode value so it can be recalculated next time
+ hashCode = 0;
}
public boolean hasExtraParameter() {
// + signature
// + ")";
}
+
+ // XXX this perhaps ought to take account of the other fields in advice ...
public boolean equals(Object other) {
if (! (other instanceof Advice)) return false;
Advice o = (Advice) other;
- return o.attribute.equals(attribute)
- && o.pointcut.equals(pointcut)
- && o.signature.equals(signature);
+ return o.kind.equals(kind)
+ && ((o.pointcut == null) ? (pointcut == null) : o.pointcut.equals(pointcut))
+ && ((o.signature == null) ? (signature == null) : o.signature.equals(signature));
+
}
- private volatile int hashCode = 0;
+
+ private volatile int hashCode = 0;
public int hashCode() {
- if (hashCode == 0) {
+ if (hashCode == 0) {
int result = 17;
result = 37*result + kind.hashCode();
- result = 37*result + pointcut.hashCode();
- if (signature != null) result = 37*result + signature.hashCode();
- hashCode = result;
- }
+ result = 37*result + ((pointcut == null) ? 0 : pointcut.hashCode());
+ result = 37*result + ((signature == null) ? 0 : signature.hashCode());
+ hashCode = result;
+ }
return hashCode;
}
public AnnotationX getNewAnnotation() {
return newAnnotation;
}
+
+ public boolean equals(Object other) {
+ if (!(other instanceof AnnotationOnTypeMunger)) return false;
+ AnnotationOnTypeMunger o = (AnnotationOnTypeMunger)other;
+ return newAnnotation.getSignature().equals(o.newAnnotation.getSignature());
+ }
+
+ private volatile int hashCode = 0;
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37*result + newAnnotation.getSignature().hashCode();
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
}
public boolean equals(Object other) {
if (! (other instanceof Member)) return false;
Member o = (Member) other;
-
- return (kind == o.getKind()
- && name.equals(o.getName())
- && signature.equals(o.getSignature())
- && declaringType.equals(o.getDeclaringType()));
- }
-
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#compareTo(java.lang.Object)
- */
- public int compareTo(Object other) {
- Member o = (Member) other;
-
- int i = getName().compareTo(o.getName());
- if (i != 0) return i;
- return getSignature().compareTo(o.getSignature());
+ return (getKind() == o.getKind()
+ && getName().equals(o.getName())
+ && getSignature().equals(o.getSignature())
+ && getDeclaringType().equals(o.getDeclaringType()));
}
/**
public int hashCode() {
if (hashCode == 0) {
int result = 17;
- result = 37*result + kind.hashCode();
- result = 37*result + name.hashCode();
- result = 37*result + signature.hashCode();
- result = 37*result + declaringType.hashCode();
+ result = 37*result + getKind().hashCode();
+ result = 37*result + getName().hashCode();
+ result = 37*result + getSignature().hashCode();
+ result = 37*result + getDeclaringType().hashCode();
hashCode = result;
}
return hashCode;
}
+ /* (non-Javadoc)
+ * @see org.aspectj.weaver.Member#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object other) {
+ Member o = (Member) other;
+
+ int i = getName().compareTo(o.getName());
+ if (i != 0) return i;
+ return getSignature().compareTo(o.getSignature());
+ }
+
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(returnType.getName());
this.implClassName = implClassName;
}
+ public boolean equals(Object other) {
+ if (!(other instanceof MethodDelegateTypeMunger)) return false;
+ MethodDelegateTypeMunger o = (MethodDelegateTypeMunger)other;
+ return ((o.aspect == null) ? (aspect == null ) : aspect.equals(o.aspect))
+ && ((o.typePattern == null) ? (typePattern == null ) : typePattern.equals(o.typePattern))
+ && ((o.implClassName == null) ? (implClassName == null) : implClassName.equals(o.implClassName));
+ }
+
+ private volatile int hashCode = 0;
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37*result + ((aspect == null) ? 0 : aspect.hashCode());
+ result = 37*result + ((typePattern == null) ? 0 : typePattern.hashCode());
+ result = 37*result + ((implClassName == null) ? 0 : implClassName.hashCode());
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
public ResolvedMember getDelegate(ResolvedType targetType) {
return AjcMemberMaker.itdAtDeclareParentsField(
targetType,
this.typePattern = typePattern;
}
+ public boolean equals(Object other) {
+ if (!(other instanceof FieldHostTypeMunger)) return false;
+ FieldHostTypeMunger o = (FieldHostTypeMunger)other;
+ return ((o.aspect == null) ? (aspect == null ) : aspect.equals(o.aspect))
+ && ((o.typePattern == null) ? (typePattern == null ) : typePattern.equals(o.typePattern));
+ }
+
+ public int hashCode() {
+ int result = 17;
+ result = 37*result + ((aspect == null) ? 0 : aspect.hashCode());
+ result = 37*result + ((typePattern == null) ? 0 : typePattern.hashCode());
+ return result;
+ }
+
public void write(DataOutputStream s) throws IOException {
kind.write(s);
signature.write(s);
}
+ public boolean equals(Object other) {
+ if (!(other instanceof NewConstructorTypeMunger)) return false;
+ NewConstructorTypeMunger o = (NewConstructorTypeMunger)other;
+ return ((o.syntheticConstructor == null) ? (syntheticConstructor == null )
+ : syntheticConstructor.equals(o.syntheticConstructor))
+ & ((o.explicitConstructor == null) ? (explicitConstructor == null )
+ : explicitConstructor.equals(o.explicitConstructor));
+ }
+
+ private volatile int hashCode = 0;
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37*result + ((syntheticConstructor == null) ? 0 : syntheticConstructor.hashCode());
+ result = 37*result + ((explicitConstructor == null) ? 0 : explicitConstructor.hashCode());
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
// doesnt seem required....
// public ResolvedMember getDispatchMethod(UnresolvedType aspectType) {
// return AjcMemberMaker.interMethodBody(signature, aspectType);
public void setExplicitConstructor(ResolvedMember explicitConstructor) {
this.explicitConstructor = explicitConstructor;
+ // reset hashCode so that its recalculated with new value
+ hashCode = 0;
}
public ResolvedMember getMatchingSyntheticMember(Member member, ResolvedType aspectType) {
return nftm;
}
+ public boolean equals(Object other) {
+ if (! (other instanceof NewFieldTypeMunger)) return false;
+ NewFieldTypeMunger o = (NewFieldTypeMunger) other;
+ return kind.equals(o.kind)
+ && ((o.signature == null) ? (signature == null ) : signature.equals(o.signature))
+ && ((o.declaredSignature == null) ? (declaredSignature == null ) : declaredSignature.equals(o.declaredSignature))
+ && ((o.typeVariableAliases == null) ? (typeVariableAliases == null ) : typeVariableAliases.equals(o.typeVariableAliases));
+ }
+
+ public int hashCode() {
+ int result = 17;
+ result = 37*result + kind.hashCode();
+ result = 37*result + ((signature == null) ? 0 : signature.hashCode());
+ result = 37*result + ((declaredSignature == null) ? 0 : declaredSignature.hashCode());
+ result = 37*result + ((typeVariableAliases == null) ? 0 : typeVariableAliases.hashCode());
+ return result;
+ }
+
}
return nmtm;
}
+ public boolean equals(Object other) {
+ if (! (other instanceof NewMethodTypeMunger)) return false;
+ NewMethodTypeMunger o = (NewMethodTypeMunger) other;
+ return kind.equals(o.kind)
+ && ((o.signature == null) ? (signature == null ) : signature.equals(o.signature))
+ && ((o.declaredSignature == null) ? (declaredSignature == null ) : declaredSignature.equals(o.declaredSignature))
+ && ((o.typeVariableAliases == null) ? (typeVariableAliases == null ) : typeVariableAliases.equals(o.typeVariableAliases));
+ }
+
+ public int hashCode() {
+ int result = 17;
+ result = 37*result + kind.hashCode();
+ result = 37*result + ((signature == null) ? 0 : signature.hashCode());
+ result = 37*result + ((declaredSignature == null) ? 0 : declaredSignature.hashCode());
+ result = 37*result + ((typeVariableAliases == null) ? 0 : typeVariableAliases.hashCode());
+ return result;
+ }
}
return newParent;
}
-
+ public boolean equals(Object other) {
+ if (! (other instanceof NewParentTypeMunger)) return false;
+ NewParentTypeMunger o = (NewParentTypeMunger) other;
+ return newParent.equals(o.newParent);
+ }
+
+ private volatile int hashCode = 0;
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37*result + newParent.hashCode();
+ hashCode = result;
+ }
+ return hashCode;
+ }
}
private final UnresolvedType interfaceType;
private final Pointcut testPointcut;
private TypePattern lazyTestTypePattern;
+
+ public boolean equals(Object other) {
+ if (!(other instanceof PerObjectInterfaceTypeMunger)) return false;
+ PerObjectInterfaceTypeMunger o = (PerObjectInterfaceTypeMunger)other;
+ return ((o.testPointcut == null) ? (testPointcut == null ) : testPointcut.equals(o.testPointcut))
+ && ((o.lazyTestTypePattern == null) ? (lazyTestTypePattern == null ) : lazyTestTypePattern.equals(o.lazyTestTypePattern));
+ }
+ private volatile int hashCode = 0;
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37*result + ((testPointcut == null) ? 0 : testPointcut.hashCode());
+ result = 37*result + ((lazyTestTypePattern == null) ? 0 : lazyTestTypePattern.hashCode());
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
public PerObjectInterfaceTypeMunger(UnresolvedType aspectType, Pointcut testPointcut) {
super(PerObjectInterface, null);
this.testPointcut = testPointcut;
}
PerThisOrTargetPointcutVisitor v = new PerThisOrTargetPointcutVisitor(!isPerThis, aspectType);
lazyTestTypePattern = v.getPerTypePointcut(testPointcut);
+ // reset hashCode so that its recalculated with the new lazyTestTypePattern
+ hashCode = 0;
}
return lazyTestTypePattern;
}
this.testPointcut = testPointcut;
}
+ public boolean equals(Object other) {
+ if (!(other instanceof PerTypeWithinTargetTypeMunger)) return false;
+ PerTypeWithinTargetTypeMunger o = (PerTypeWithinTargetTypeMunger)other;
+ return ((o.testPointcut == null) ? (testPointcut == null ) : testPointcut.equals(o.testPointcut))
+ && ((o.aspectType == null) ? (aspectType == null ) : aspectType.equals(o.aspectType));
+ }
+
+ private volatile int hashCode = 0;
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37*result + ((testPointcut == null) ? 0 : testPointcut.hashCode());
+ result = 37*result + ((aspectType == null) ? 0 : aspectType.hashCode());
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
public void write(DataOutputStream s) throws IOException {
throw new RuntimeException("shouldn't be serialized");
}
return null;
}
+ public boolean equals(Object other) {
+ if (! (other instanceof PrivilegedAccessMunger)) return false;
+ PrivilegedAccessMunger o = (PrivilegedAccessMunger) other;
+ return kind.equals(o.kind)
+ && ((o.signature == null) ? (signature == null ) : signature.equals(o.signature))
+ && ((o.declaredSignature == null) ? (declaredSignature == null ) : declaredSignature.equals(o.declaredSignature))
+ && ((o.typeVariableAliases == null) ? (typeVariableAliases == null ) : typeVariableAliases.equals(o.typeVariableAliases));
+ }
+
+ public int hashCode() {
+ int result = 17;
+ result = 37*result + kind.hashCode();
+ result = 37*result + ((signature == null) ? 0 : signature.hashCode());
+ result = 37*result + ((declaredSignature == null) ? 0 : declaredSignature.hashCode());
+ result = 37*result + ((typeVariableAliases == null) ? 0 : typeVariableAliases.hashCode());
+ return result;
+ }
+
}
return munger.getTypeVariableAliases();
}
+ public boolean equals(Object other) {
+ if (! (other instanceof BcelTypeMunger)) return false;
+ BcelTypeMunger o = (BcelTypeMunger) other;
+ return ((o.getMunger() == null) ? (getMunger() == null) : o.getMunger().equals(getMunger()))
+ && ((o.getAspectType() == null) ? (getAspectType() == null) : o.getAspectType().equals(getAspectType()));
+ }
+
+ private volatile int hashCode = 0;
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37*result + ((getMunger() == null) ? 0 : getMunger().hashCode());
+ result = 37*result + ((getAspectType() == null) ? 0 : getAspectType().hashCode());
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
+
/**
* Some type mungers are created purely to help with the implementation of shadow mungers.
* For example to support the cflow() pointcut we create a new cflow field in the aspect, and