summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2011-03-09 01:14:39 +0000
committeraclement <aclement>2011-03-09 01:14:39 +0000
commit945402f177906a2a421b092050c2baab31665c59 (patch)
tree7b1c3eb0cdf1f5d76b8204c1e4d9b43f306100ce
parent197990bf582ce3098ecd00b5ec7d2c49449cbf73 (diff)
downloadaspectj-945402f177906a2a421b092050c2baab31665c59.tar.gz
aspectj-945402f177906a2a421b092050c2baab31665c59.zip
339300
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
index d1ba4203f..649a74b99 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
@@ -28,6 +28,7 @@ import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.AttributeUtils;
import org.aspectj.apache.bcel.classfile.ConstantClass;
import org.aspectj.apache.bcel.classfile.ConstantPool;
+import org.aspectj.apache.bcel.classfile.EnclosingMethod;
import org.aspectj.apache.bcel.classfile.Field;
import org.aspectj.apache.bcel.classfile.InnerClass;
import org.aspectj.apache.bcel.classfile.InnerClasses;
@@ -842,7 +843,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
public ResolvedType getOuterClass() {
if (!isNested()) {
- throw new IllegalStateException("Can't get the outer class of a non-nested type");
+ throw new IllegalStateException("Can't get the outer class of non-nested type: " + className);
}
// try finding outer class name from InnerClasses attribute assigned to this class
@@ -878,6 +879,19 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
}
}
+ for (Attribute attr : javaClass.getAttributes()) { // bug339300
+ ConstantPool cpool = javaClass.getConstantPool();
+ if (attr instanceof EnclosingMethod) {
+ EnclosingMethod enclosingMethodAttribute = (EnclosingMethod) attr;
+ if (enclosingMethodAttribute.getEnclosingClassIndex() != 0) {
+ ConstantClass outerClassInfo = enclosingMethodAttribute.getEnclosingClass();
+ String outerClassName = cpool.getConstantUtf8(outerClassInfo.getNameIndex()).getValue().replace('/', '.');
+ UnresolvedType outer = UnresolvedType.forName(outerClassName);
+ return outer.resolve(getResolvedTypeX().getWorld());
+ }
+ }
+ }
+
// try finding outer class name by assuming standard class name mangling convention of javac for this class
int lastDollar = className.lastIndexOf('$');
String superClassName = className.substring(0, lastDollar);