summaryrefslogtreecommitdiffstats
path: root/weaver/src/org
diff options
context:
space:
mode:
authoraclement <aclement>2005-08-26 09:09:35 +0000
committeraclement <aclement>2005-08-26 09:09:35 +0000
commit100d9e056735e85610fe9072527a0369dc867ec5 (patch)
treeba7ac62e4dbabd1859fa92696743697399e38db2 /weaver/src/org
parent37c44d35a618695c1abb2e204cc31c5e38bfcbe5 (diff)
downloadaspectj-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.java10
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWorld.java13
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() {