From: aclement Date: Fri, 8 Jul 2005 15:17:23 +0000 (+0000) Subject: generics: can determine if java class is generic. X-Git-Tag: PRE_ANDY~69 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a248b806f991d6444f43b848a7d88935c4dea907;p=aspectj.git generics: can determine if java class is generic. --- 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 9c1ca398f..29676da59 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 ClassGen class. - * @version $Id: JavaClass.java,v 1.5 2005/07/08 10:19:14 acolyer Exp $ + * @version $Id: JavaClass.java,v 1.6 2005/07/08 15:17:23 aclement Exp $ * @see org.aspectj.apache.bcel.generic.ClassGen * @author M. Dahm */ @@ -98,6 +98,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Node { private Attribute[] attributes; // attributes defined in the class private Annotation[] annotations; // annotations defined on the class private byte source = HEAP; // Generated in memory + private boolean isGeneric = false; public static final byte HEAP = 1; public static final byte FILE = 2; @@ -884,7 +885,12 @@ public class JavaClass extends AccessFlags implements Cloneable, Node { return signatureAttributeString; } -private void loadGenericSignatureInfoIfNecessary() { + public boolean isGeneric() { + loadGenericSignatureInfoIfNecessary(); + return isGeneric; + } + + private void loadGenericSignatureInfoIfNecessary() { if (!searchedForSignatureAttribute) { boolean found=false; for(int i=0; !found && i < attributes.length; i++) { @@ -894,9 +900,10 @@ private void loadGenericSignatureInfoIfNecessary() { found=true; } } + isGeneric = found && signatureAttributeString.charAt(0)=='<'; searchedForSignatureAttribute=true; } -} + } /** * the parsed version of the above