From 4316c4456bee9357df9845153d8a5c34e57520b2 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 5 Jan 2009 22:02:29 +0000 Subject: [PATCH] 259649: equivalentTo() added --- .../aspectj/weaver/ConcreteTypeMunger.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) 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; + } } -- 2.39.5