From 90525666070cf73478c6dd5dc09d2278dee5ba8f Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 2 Nov 2009 16:57:15 +0000 Subject: [PATCH] 293620: c5 --- .../aspectj/weaver/bcel/BcelObjectType.java | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index 91c0eb4d7..6aba253d6 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -14,6 +14,7 @@ package org.aspectj.weaver.bcel; import java.io.PrintStream; +import java.lang.ref.WeakReference; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; @@ -108,6 +109,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { private boolean isCodeStyleAspect = false; // not redundant with field // above! + private WeakReference superTypeReference = new WeakReference(null); + private int bitflag = 0x0000; // discovery bits @@ -212,18 +215,23 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { if (isObject) { return null; } - ensureGenericSignatureUnpacked(); - if (superclassSignature == null) { - if (superclassName == null) { - superclassName = javaClass.getSuperclassName(); + ResolvedType supertype = superTypeReference.get(); + if (supertype == null) { + ensureGenericSignatureUnpacked(); + if (superclassSignature == null) { + if (superclassName == null) { + superclassName = javaClass.getSuperclassName(); + } + superclassSignature = getResolvedTypeX().getWorld().resolve(UnresolvedType.forName(superclassName)).getSignature(); } - superclassSignature = getResolvedTypeX().getWorld().resolve(UnresolvedType.forName(superclassName)).getSignature(); + World world = getResolvedTypeX().getWorld(); + supertype = world.resolve(UnresolvedType.forSignature(superclassSignature)); + superTypeReference = new WeakReference(supertype); } - World world = getResolvedTypeX().getWorld(); - ResolvedType res = world.resolve(UnresolvedType.forSignature(superclassSignature)); - return res; + return supertype; } + public World getWorld() { return getResolvedTypeX().getWorld(); } @@ -294,13 +302,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } if (typeVars == null) { - GenericSignature.ClassSignature classSig = getGenericClassTypeSignature();// cachedGenericClassTypeSignature - // ; - // / - // / - // javaClass - // . - // getGenericClassTypeSignature(); + GenericSignature.ClassSignature classSig = getGenericClassTypeSignature(); typeVars = new TypeVariable[classSig.formalTypeParameters.length]; for (int i = 0; i < typeVars.length; i++) { GenericSignature.FormalTypeParameter ftp = classSig.formalTypeParameters[i]; @@ -588,7 +590,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { return false; } ensureAnnotationsUnpacked(); - for (int i = 0; i < annotationTypes.length; i++) { + for (int i = 0, max = annotationTypes.length; i < max; i++) { UnresolvedType ax = annotationTypes[i]; if (ax == null) { throw new RuntimeException("Annotation entry " + i + " on type " + this.getResolvedTypeX().getName() + " is null!"); @@ -715,7 +717,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { + "', failed to resolve type '" + typeSignature + "'"); } annotationTypes[i] = rType; - annotations[i] = new BcelAnnotation(annotation, w); + annotations[i] = new BcelAnnotation(annotation, rType); } } } finally { -- 2.39.5