From 542fa0dedcb8fe8b06c9fef48450bda262add60f Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 3 Feb 2009 17:34:00 +0000 Subject: [PATCH] 263323: broken aspect weaving --- .../src/org/aspectj/weaver/bcel/BcelAdvice.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java index 62169bbea..1086bd452 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java @@ -36,6 +36,8 @@ import org.aspectj.weaver.BCException; import org.aspectj.weaver.IEclipseSourceContext; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.Member; +import org.aspectj.weaver.ReferenceType; +import org.aspectj.weaver.ReferenceTypeDelegate; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedMemberImpl; import org.aspectj.weaver.ResolvedType; @@ -212,13 +214,26 @@ class BcelAdvice extends Advice { if (concreteAspect.getWorld().isXnoInline()) return false; // System.err.println("isWoven? " + ((BcelObjectType)concreteAspect).getLazyClassGen().getWeaverState()); - return BcelWorld.getBcelObjectType(concreteAspect).getLazyClassGen().isWoven(); + BcelObjectType boType = BcelWorld.getBcelObjectType(concreteAspect); + if (boType == null) { + // Could be a symptom that the aspect failed to build last build... return the default answer of false + return false; + } + return boType.getLazyClassGen().isWoven(); } public boolean implementOn(Shadow s) { hasMatchedAtLeastOnce = true; BcelShadow shadow = (BcelShadow) s; + // pr263323 - if the aspect is broken then the delegate will not be usable for weaving + if (concreteAspect instanceof ReferenceType) { + ReferenceTypeDelegate rtDelegate = ((ReferenceType) concreteAspect).getDelegate(); + if (!(rtDelegate instanceof BcelObjectType)) { + return false; + } + } + // remove any unnecessary exceptions if the compiler option is set to // error or warning and if this piece of advice throws exceptions // (bug 129282). This may be expanded to include other compiler warnings -- 2.39.5