summaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-07-08 10:19:14 +0000
committeracolyer <acolyer>2005-07-08 10:19:14 +0000
commit103c4a518762b9914377632a8f31a4a60e228368 (patch)
treee49b94af5821dac3850e5dbcaa3bd0bb9fb1ec0d /bcel-builder
parentb01c15c44872fe270ebeec4cf0702bbb6f5f7f24 (diff)
downloadaspectj-103c4a518762b9914377632a8f31a4a60e228368.tar.gz
aspectj-103c4a518762b9914377632a8f31a4a60e228368.zip
lazy loading and parsing of generic signature
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
index 0cec654ca..9c1ca398f 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
@@ -77,7 +77,7 @@ import java.util.StringTokenizer;
* class file. Those interested in programatically generating classes
* should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
- * @version $Id: JavaClass.java,v 1.4 2005/06/26 20:27:40 acolyer Exp $
+ * @version $Id: JavaClass.java,v 1.5 2005/07/08 10:19:14 acolyer Exp $
* @see org.aspectj.apache.bcel.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -111,6 +111,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
// state for dealing with generic signature string
private String signatureAttributeString = null;
+ private Signature signatureAttribute = null;
private boolean searchedForSignatureAttribute = false;
/**
@@ -879,17 +880,34 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
* Coded for performance - searches for the attribute only when requested - only searches for it once.
*/
public final String getGenericSignature() {
+ loadGenericSignatureInfoIfNecessary();
+ return signatureAttributeString;
+ }
+
+private void loadGenericSignatureInfoIfNecessary() {
if (!searchedForSignatureAttribute) {
boolean found=false;
for(int i=0; !found && i < attributes.length; i++) {
if(attributes[i] instanceof Signature) {
- signatureAttributeString = ((Signature)attributes[i]).getSignature();
+ signatureAttribute = ((Signature)attributes[i]);
+ signatureAttributeString = signatureAttribute.getSignature();
found=true;
}
}
searchedForSignatureAttribute=true;
}
- return signatureAttributeString;
+}
+
+ /**
+ * the parsed version of the above
+ */
+ public final Signature.ClassSignature getGenericClassTypeSignature() {
+ loadGenericSignatureInfoIfNecessary();
+ if (signatureAttribute != null) {
+ return signatureAttribute.asClassSignature();
+ } else {
+ return null;
+ }
}
}