* 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 {
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) {
/**
* 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;
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
* 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>
*/
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;
}
* 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];
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
*/
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);
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];
}