diff options
author | aclement <aclement> | 2005-08-26 09:09:35 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-08-26 09:09:35 +0000 |
commit | 100d9e056735e85610fe9072527a0369dc867ec5 (patch) | |
tree | ba7ac62e4dbabd1859fa92696743697399e38db2 /weaver/src/org | |
parent | 37c44d35a618695c1abb2e204cc31c5e38bfcbe5 (diff) | |
download | aspectj-100d9e056735e85610fe9072527a0369dc867ec5.tar.gz aspectj-100d9e056735e85610fe9072527a0369dc867ec5.zip |
Fix for pr107713: classcastexception cant happen now.
Diffstat (limited to 'weaver/src/org')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java | 10 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelWorld.java | 13 |
2 files changed, 18 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index 091f7b0e7..f27fad1dd 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -947,8 +947,12 @@ public class BcelWeaver implements IWeaver { for (Iterator i = input.getClassFileIterator(); i.hasNext(); ) { UnwovenClassFile classFile = (UnwovenClassFile)i.next(); String className = classFile.getClassName(); - BcelObjectType classType = getClassType(className); - processReweavableStateIfPresent(className, classType); + BcelObjectType classType = getClassType(className); + + // null return from getClassType() means the delegate is an eclipse source type - so + // there *cant* be any reweavable state... (he bravely claimed...) + if (classType !=null) + processReweavableStateIfPresent(className, classType); } requestor.addingTypeMungers(); @@ -1120,7 +1124,7 @@ public class BcelWeaver implements IWeaver { } } - // helper method + /** helper method - will return NULL if the underlying delegate is an EclipseSourceType and not a BcelObjectType */ public BcelObjectType getClassType(String forClass) { return BcelWorld.getBcelObjectType(world.resolve(forClass)); } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 56b2ae507..0af68c256 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -448,9 +448,18 @@ public class BcelWorld extends World implements Repository { return new BcelPerClauseAspectAdder(aspect, kind); } + /** + * Retrieve a bcel delegate for an aspect - this will return NULL if the + * delegate is an EclipseSourceType and not a BcelObjectType - this happens + * quite often when incrementally compiling. + */ public static BcelObjectType getBcelObjectType(ResolvedType concreteAspect) { - //XXX need error checking - return (BcelObjectType) ((ReferenceType)concreteAspect).getDelegate(); + ReferenceTypeDelegate rtDelegate = ((ReferenceType)concreteAspect).getDelegate(); + if (rtDelegate instanceof BcelObjectType) { + return (BcelObjectType)rtDelegate; + } else { + return null; + } } public void tidyUp() { |