summaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-06-26 20:27:40 +0000
committeracolyer <acolyer>2005-06-26 20:27:40 +0000
commit25ad67c1f6b2908716c8072112fc4458844a658e (patch)
tree4ea6bce189731add243f684ed53cafc6259bcb50 /bcel-builder
parent24301586af99313d8ffd868e37b41bd6b59c2fd3 (diff)
downloadaspectj-25ad67c1f6b2908716c8072112fc4458844a658e.tar.gz
aspectj-25ad67c1f6b2908716c8072112fc4458844a658e.zip
added getGenericSignature method
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java28
1 files changed, 27 insertions, 1 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 650767d9e..0cec654ca 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.3 2004/11/19 16:45:18 aclement Exp $
+ * @version $Id: JavaClass.java,v 1.4 2005/06/26 20:27:40 acolyer Exp $
* @see org.aspectj.apache.bcel.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -109,6 +109,10 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
// Annotations are collected from certain attributes, don't do it more than necessary!
private boolean annotationsOutOfDate = true;
+ // state for dealing with generic signature string
+ private String signatureAttributeString = null;
+ private boolean searchedForSignatureAttribute = false;
+
/**
* In cases where we go ahead and create something,
* use the default SyntheticRepository, because we
@@ -866,4 +870,26 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
return vec.toArray();
}
+
+ /**
+ * Hunts for a signature attribute on the member and returns its contents. So where the 'regular' signature
+ * may be Ljava/util/Vector; the signature attribute will tell us
+ * e.g. "<E:>Ljava/lang/Object". We can learn the type variable names, their bounds,
+ * and the true superclass and superinterface types (including any parameterizations)
+ * Coded for performance - searches for the attribute only when requested - only searches for it once.
+ */
+ public final String getGenericSignature() {
+ if (!searchedForSignatureAttribute) {
+ boolean found=false;
+ for(int i=0; !found && i < attributes.length; i++) {
+ if(attributes[i] instanceof Signature) {
+ signatureAttributeString = ((Signature)attributes[i]).getSignature();
+ found=true;
+ }
+ }
+ searchedForSignatureAttribute=true;
+ }
+ return signatureAttributeString;
+ }
+
}