From 680e72392c69c9d37db19ffeceaa61e89acf550f Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 4 Apr 2006 08:10:19 +0000 Subject: [PATCH] future work (see 133532) --- .../aspectj/weaver/ConcreteTypeMunger.java | 8 +++++ .../aspectj/weaver/CrosscuttingMembers.java | 32 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java b/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java index 24ce48348..ef9a88029 100644 --- a/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java @@ -25,6 +25,14 @@ public abstract class ConcreteTypeMunger implements PartialOrder.PartialComparab this.aspectType = aspectType; } + // An EclipseTypeMunger and a BcelTypeMunger may say TRUE for equivalentTo()... + public boolean equivalentTo(Object other) { + if (! (other instanceof ConcreteTypeMunger)) return false; + ConcreteTypeMunger o = (ConcreteTypeMunger) other; + return ((o.getMunger() == null) ? (getMunger() == null) : o.getMunger().equals(getMunger())) + && ((o.getAspectType() == null) ? (getAspectType() == null) : o.getAspectType().equals(getAspectType())); + } + //public abstract boolean munge(LazyClassGen gen); diff --git a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java index 78fc05868..fcbd967cf 100644 --- a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java +++ b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java @@ -277,6 +277,38 @@ public class CrosscuttingMembers { otherTypeMungers.addAll(other.typeMungers); } + // initial go at equivalence logic rather than set compare (see pr133532) +// if (theseTypeMungers.size()!=otherTypeMungers.size()) { +// changed = true; +// typeMungers = other.typeMungers; +// } else { +// boolean foundInequality=false; +// for (Iterator iter = theseTypeMungers.iterator(); iter.hasNext() && !foundInequality;) { +// Object thisOne = (Object) iter.next(); +// boolean foundInOtherSet = false; +// for (Iterator iterator = otherTypeMungers.iterator(); iterator.hasNext();) { +// Object otherOne = (Object) iterator.next(); +// if (thisOne instanceof ConcreteTypeMunger && otherOne instanceof ConcreteTypeMunger) { +// if (((ConcreteTypeMunger)thisOne).equivalentTo(otherOne)) { +// foundInOtherSet=true; +// } else if (thisOne.equals(otherOne)) { +// foundInOtherSet=true; +// } +// } else { +// if (thisOne.equals(otherOne)) { +// foundInOtherSet=true; +// } +// } +// } +// if (!foundInOtherSet) foundInequality=true; +// } +// if (foundInequality) { +// changed = true; +// typeMungers = other.typeMungers; +//// } else { +//// typeMungers = other.typeMungers; +// } +// } if (!theseTypeMungers.equals(otherTypeMungers)) { changed = true; typeMungers = other.typeMungers; -- 2.39.5