]> source.dussan.org Git - aspectj.git/commitdiff
263323: broken aspect weaving
authoraclement <aclement>
Tue, 3 Feb 2009 17:34:00 +0000 (17:34 +0000)
committeraclement <aclement>
Tue, 3 Feb 2009 17:34:00 +0000 (17:34 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java

index 62169bbea8f40562541a1d430fb58076caa37314..1086bd45237aefb9e23c6f3c715f28cc0bfbf12f 100644 (file)
@@ -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