From: aclement Date: Mon, 5 Jan 2009 22:02:29 +0000 (+0000) Subject: 259649: equivalentTo() added X-Git-Tag: pre268419~254 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4316c4456bee9357df9845153d8a5c34e57520b2;p=aspectj.git 259649: equivalentTo() added --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ConcreteTypeMunger.java b/org.aspectj.matcher/src/org/aspectj/weaver/ConcreteTypeMunger.java index 524d091be..7e25ce8c1 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ConcreteTypeMunger.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ConcreteTypeMunger.java @@ -26,13 +26,18 @@ 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())); - // } + /** + * Equivalence can be true for an EclipseTypeMunger and a BcelTypeMunger that represent the + * same transformation (just at different points in the pipeline). + */ + 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); @@ -141,4 +146,8 @@ public abstract class ConcreteTypeMunger implements PartialOrder.PartialComparab } return false; } + + public boolean shouldOverwrite() { + return true; + } }