@@ -62,7 +62,7 @@ import org.aspectj.apache.bcel.generic.Type; | |||
* This class represents the field info structure, i.e., the representation for a variable in the class. See JVM specification for | |||
* details. | |||
* | |||
* @version $Id: Field.java,v 1.5 2009/09/10 15:35:05 aclement Exp $ | |||
* @version $Id: Field.java,v 1.6 2009/09/15 03:33:52 aclement Exp $ | |||
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> | |||
*/ | |||
public final class Field extends FieldOrMethod { | |||
@@ -126,11 +126,6 @@ public final class Field extends FieldOrMethod { | |||
return buf.toString(); | |||
} | |||
/** deep copy of this field */ | |||
public final Field copy(ConstantPool constant_pool) { | |||
return (Field) copy_(constant_pool); | |||
} | |||
/** return the type of the field */ | |||
public Type getType() { | |||
if (fieldType == null) { |
@@ -66,10 +66,10 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnotations; | |||
/** | |||
* Abstract super class for fields and methods. | |||
* | |||
* @version $Id: FieldOrMethod.java,v 1.10 2009/09/10 15:35:05 aclement Exp $ | |||
* @version $Id: FieldOrMethod.java,v 1.11 2009/09/15 03:33:52 aclement Exp $ | |||
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> | |||
*/ | |||
public abstract class FieldOrMethod extends Modifiers implements Cloneable, Node { | |||
public abstract class FieldOrMethod extends Modifiers implements Node { | |||
protected int nameIndex; | |||
protected int signatureIndex; | |||
protected Attribute[] attributes; | |||
@@ -161,22 +161,6 @@ public abstract class FieldOrMethod extends Modifiers implements Cloneable, Node | |||
return getSignature(); | |||
} | |||
/** | |||
* @return deep copy of this field | |||
*/ | |||
protected FieldOrMethod copy_(ConstantPool constant_pool) { | |||
FieldOrMethod c = null; | |||
try { | |||
c = (FieldOrMethod) clone(); | |||
} catch (CloneNotSupportedException e) { | |||
} | |||
c.cpool = constant_pool; | |||
c.attributes = AttributeUtils.copy(attributes, constant_pool); | |||
return c; | |||
} | |||
public AnnotationGen[] getAnnotations() { | |||
// Ensure we have unpacked any attributes that contain annotations. | |||
// We don't remove these annotation attributes from the attributes list, they |
@@ -80,7 +80,7 @@ import org.aspectj.apache.bcel.util.SyntheticRepository; | |||
* The intent of this class is to represent a parsed or otherwise existing 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.19 2009/09/14 20:29:10 aclement Exp $ | |||
* @version $Id: JavaClass.java,v 1.20 2009/09/15 03:33:52 aclement Exp $ | |||
* @see org.aspectj.apache.bcel.generic.ClassGen | |||
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> | |||
*/ | |||
@@ -601,40 +601,6 @@ public class JavaClass extends Modifiers implements Cloneable, Node { | |||
return buf.toString(); | |||
} | |||
/** | |||
* @return deep copy of this class | |||
*/ | |||
public JavaClass copy() { | |||
JavaClass c = null; | |||
try { | |||
c = (JavaClass) clone(); | |||
} catch (CloneNotSupportedException e) { | |||
} | |||
c.cpool = cpool.copy(); | |||
c.interfaces = interfaces.clone(); | |||
c.interfacenames = interfacenames.clone(); | |||
c.fields = new Field[fields.length]; | |||
for (int i = 0; i < fields.length; i++) { | |||
c.fields[i] = fields[i].copy(c.cpool); | |||
} | |||
c.methods = new Method[methods.length]; | |||
for (int i = 0; i < methods.length; i++) { | |||
c.methods[i] = methods[i].copy(c.cpool); | |||
} | |||
c.attributes = AttributeUtils.copy(attributes, c.cpool); | |||
// J5SUPPORT: As the annotations exist as attributes against the class, copying | |||
// the attributes will copy the annotations across, so we don't have to | |||
// also copy them individually. | |||
return c; | |||
} | |||
public final boolean isSuper() { | |||
return (modifiers & Constants.ACC_SUPER) != 0; | |||
} |
@@ -68,13 +68,12 @@ import org.aspectj.apache.bcel.generic.Type; | |||
* This class represents the method info structure, i.e., the representation for a method in the class. See JVM specification for | |||
* details. A method has access flags, a name, a signature and a number of attributes. | |||
* | |||
* @version $Id: Method.java,v 1.9 2009/09/10 15:35:05 aclement Exp $ | |||
* @version $Id: Method.java,v 1.10 2009/09/15 03:33:52 aclement Exp $ | |||
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> | |||
*/ | |||
public final class Method extends FieldOrMethod { | |||
public static final AnnotationGen[][] NO_PARAMETER_ANNOTATIONS = new AnnotationGen[][] {}; | |||
public static final AnnotationGen[] NO_ANNOTATIONS = new AnnotationGen[] {}; | |||
public static final Method[] NoMethods = new Method[0]; | |||
@@ -182,13 +181,6 @@ public final class Method extends FieldOrMethod { | |||
return buf.toString(); | |||
} | |||
/** | |||
* Return a deep copy of this method | |||
*/ | |||
public final Method copy(ConstantPool constant_pool) { | |||
return (Method) copy_(constant_pool); | |||
} | |||
/** | |||
* @return return type of method | |||
*/ | |||
@@ -248,7 +240,7 @@ public final class Method extends FieldOrMethod { | |||
count += invisibleOnes.length; | |||
} | |||
AnnotationGen[] complete = NO_ANNOTATIONS; | |||
AnnotationGen[] complete = AnnotationGen.NO_ANNOTATIONS; | |||
if (count != 0) { | |||
complete = new AnnotationGen[visibleOnes.length + invisibleOnes.length]; | |||
System.arraycopy(visibleOnes, 0, complete, 0, visibleOnes.length); | |||
@@ -267,8 +259,9 @@ public final class Method extends FieldOrMethod { | |||
public AnnotationGen[] getAnnotationsOnParameter(int i) { | |||
ensureParameterAnnotationsUnpacked(); | |||
if (unpackedParameterAnnotations == NO_PARAMETER_ANNOTATIONS) | |||
return NO_ANNOTATIONS; | |||
if (unpackedParameterAnnotations == NO_PARAMETER_ANNOTATIONS) { | |||
return AnnotationGen.NO_ANNOTATIONS; | |||
} | |||
return unpackedParameterAnnotations[i]; | |||
} | |||