svn commit: r414190 - in /jakarta/bcel/trunk: ./ .settings/ src/main/java/org/apache/bcel/classfile/ src/main/java/org/apache/bcel/generic/ src/test/java/org/apache/bcel/ src/test/java/org/apache/bcel/data/

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
Author: tcurdt
Date: Wed Jun 14 03:55:10 2006
New Revision: 414190

URL: http://svn.apache.org/viewvc?rev=414190&view=rev
Log:
GSoC: more testcases, annotation support by Dmitriy Khayredinov

Added:
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationElementValue.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassElementValue.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EnumElementValue.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationGen.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementNameValuePairGen.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java   (with props)
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java   (with props)
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java   (with props)
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationAccessFlagTestCase.java   (with props)
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationDefaultAttributeTestCase.java   (with props)
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java   (with props)
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleClass.java   (with props)
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleEnum.java   (with props)
Removed:
    jakarta/bcel/trunk/.classpath
    jakarta/bcel/trunk/.project
    jakarta/bcel/trunk/.settings/
Modified:
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValue.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValuePair.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractCounterVisitorTestCase.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/CounterVisitorTestCase.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkedType.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotation.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotationInvisible.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleAnnotation.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/package-info.java

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationDefault.java Wed Jun 14 03:55:10 2006
@@ -49,7 +49,7 @@
 	{
 		this(name_index, length, (ElementValue) null,
 				constant_pool);
-		default_value = new ElementValue(file, constant_pool);
+		default_value = ElementValue.readElementValue(file, constant_pool);
 	}
 
 	/**

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationElementValue.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationElementValue.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationElementValue.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationElementValue.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,43 @@
+package org.apache.bcel.classfile;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class AnnotationElementValue extends ElementValue
+{
+	// For annotation element values, this is the annotation
+	private AnnotationEntry annotationEntry;
+
+	public AnnotationElementValue(int type, AnnotationEntry annotationEntry,
+			ConstantPool cpool)
+	{
+		super(type, cpool);
+		if (type != ANNOTATION)
+			throw new RuntimeException(
+					"Only element values of type annotation can be built with this ctor");
+		this.annotationEntry = annotationEntry;
+	}
+
+	public void dump(DataOutputStream dos) throws IOException
+	{
+		dos.writeByte(type); // u1 type of value (ANNOTATION == '@')
+		annotationEntry.dump(dos);
+	}
+
+	public String stringifyValue()
+	{
+		StringBuffer sb = new StringBuffer();
+		sb.append(annotationEntry.toString());
+		return sb.toString();
+	}
+
+	public String toString()
+	{
+		return stringifyValue();
+	}
+
+	public AnnotationEntry getAnnotationEntry()
+	{
+		return annotationEntry;
+	}
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationElementValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationElementValue.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/AnnotationEntry.java Wed Jun 14 03:55:10 2006
@@ -17,6 +17,7 @@
 package org.apache.bcel.classfile;
 
 import java.io.DataInputStream;
+import java.io.DataOutputStream;
 import java.io.IOException;
 import org.apache.bcel.Constants;
 
@@ -87,4 +88,10 @@
     public ElementValuePair[] getElementValuePairs() {
         return element_value_pairs;
     }
+
+
+	public void dump(DataOutputStream dos)
+	{
+		// TODO Auto-generated method stub
+	}
 }

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,67 @@
+package org.apache.bcel.classfile;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class ArrayElementValue extends ElementValue
+{
+	// For array types, this is the array
+	private ElementValue[] evalues;
+
+	public String toString()
+	{
+		StringBuffer sb = new StringBuffer();
+		sb.append("{");
+		for (int i = 0; i < evalues.length; i++)
+		{
+			sb.append(evalues[i].toString());
+			if ((i + 1) < evalues.length)
+				sb.append(",");
+		}
+		sb.append("}");
+		return sb.toString();
+	}
+
+	public ArrayElementValue(int type, ElementValue[] datums, ConstantPool cpool)
+	{
+		super(type, cpool);
+		if (type != ARRAY)
+			throw new RuntimeException(
+					"Only element values of type array can be built with this ctor");
+		this.evalues = datums;
+	}
+
+	public void dump(DataOutputStream dos) throws IOException
+	{
+		dos.writeByte(type); // u1 type of value (ARRAY == '[')
+		dos.writeShort(evalues.length);
+		for (int i = 0; i < evalues.length; i++)
+		{
+			evalues[i].dump(dos);
+		}
+	}
+
+	public String stringifyValue()
+	{
+		StringBuffer sb = new StringBuffer();
+		sb.append("[");
+		for (int i = 0; i < evalues.length; i++)
+		{
+			sb.append(evalues[i].stringifyValue());
+			if ((i + 1) < evalues.length)
+				sb.append(",");
+		}
+		sb.append("]");
+		return sb.toString();
+	}
+
+	public ElementValue[] getElementValuesArray()
+	{
+		return evalues;
+	}
+
+	public int getElementValuesArraySize()
+	{
+		return evalues.length;
+	}
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ArrayElementValue.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java Wed Jun 14 03:55:10 2006
@@ -23,6 +23,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.bcel.Constants;
+import org.apache.bcel.classfile.ConstantUtf8;
 
 /**
  * Abstract super class for <em>Attribute</em> objects. Currently the
@@ -143,7 +144,7 @@
 		// Length of data in bytes
 		length = file.readInt();
 		// Compare strings to find known attribute
-		System.out.println(name);
+		// System.out.println(name);
 		for (byte i = 0; i < Constants.KNOWN_ATTRIBUTES; i++)
 		{
 			if (name.equals(Constants.ATTRIBUTE_NAMES[i]))
@@ -211,6 +212,16 @@
 		default: // Never reached
 			throw new IllegalStateException("Ooops! default case reached.");
 		}
+	}
+
+	/**
+	 * @return Name of attribute
+	 */
+	public String getName()
+	{
+		ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(name_index,
+				Constants.CONSTANT_Utf8);
+		return c.getBytes();
 	}
 
 	/**

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassElementValue.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassElementValue.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassElementValue.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassElementValue.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,44 @@
+package org.apache.bcel.classfile;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import org.apache.bcel.Constants;
+
+public class ClassElementValue extends ElementValue
+{
+	// For primitive types and string type, this points to the value entry in
+	// the cpool
+	// For 'class' this points to the class entry in the cpool
+	private int idx;
+
+	public ClassElementValue(int type, int idx, ConstantPool cpool)
+	{
+		super(type, cpool);
+		this.idx = idx;
+	}
+
+	public int getIndex()
+	{
+		return idx;
+	}
+
+	public String getClassString()
+	{
+		ConstantUtf8 c = (ConstantUtf8) cpool.getConstant(idx,
+				Constants.CONSTANT_Utf8);
+		return c.getBytes();
+	}
+
+	public String stringifyValue()
+	{
+		ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(idx,
+				Constants.CONSTANT_Utf8);
+		return cu8.getBytes();
+	}
+
+	public void dump(DataOutputStream dos) throws IOException
+	{
+		dos.writeByte(type); // u1 kind of value
+		dos.writeShort(idx);
+	}
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassElementValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassElementValue.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValue.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValue.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValue.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValue.java Wed Jun 14 03:55:10 2006
@@ -17,67 +17,128 @@
 package org.apache.bcel.classfile;
 
 import java.io.DataInputStream;
+import java.io.DataOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
- * an ElementValuePair's element value. This class will be broken out into
- * different subclasses. This is a temporary implementation.
- * 
  * @version $Id: ElementValue
- * @author  <A HREF="mailto:[email protected]">D. Brosius</A>
+ * @author <A HREF="mailto:[email protected]">D. Brosius</A>
  * @since 5.2
  */
-public class ElementValue {
+public abstract class ElementValue
+{
+	protected int type;
 
-    private byte tag;
-    private int const_value_index;
-    private int type_name_index;
-    private int const_name_index;
-    private int class_info_index;
-    private AnnotationEntry annotation;
-    private int num_values;
-    private ElementValue[] values;
-
-
-    /**
-     * Construct object from file stream.
-     * @param file Input stream
-     * @param constant_pool the constant pool
-     * @throws IOException
-     */
-    ElementValue(DataInputStream file, ConstantPool constant_pool) throws IOException {
-        tag = (file.readByte());
-        switch (tag) {
-            case 'B':
-            case 'C':
-            case 'D':
-            case 'F':
-            case 'I':
-            case 'J':
-            case 'S':
-            case 'Z':
-            case 's':
-                const_value_index = (file.readUnsignedShort());
-                break;
-            case 'e':
-                type_name_index = (file.readUnsignedShort());
-                const_name_index = (file.readUnsignedShort());
-                break;
-            case 'c':
-                class_info_index = (file.readUnsignedShort());
-                break;
-            case '@':
-                annotation = new AnnotationEntry(file, constant_pool);
-                break;
-            case '[':
-                num_values = (file.readUnsignedShort());
-                values = new ElementValue[num_values];
-                for (int i = 0; i < num_values; i++) {
-                    values[i] = new ElementValue(file, constant_pool);
-                }
-                break;
-            default:
-                throw new IOException("Invalid ElementValue tag: " + tag);
-        }
-    }
+	protected ConstantPool cpool;
+
+	public String toString()
+	{
+		return stringifyValue();
+	}
+
+	protected ElementValue(int type, ConstantPool cpool)
+	{
+		this.type = type;
+		this.cpool = cpool;
+	}
+
+	public int getElementValueType()
+	{
+		return type;
+	}
+
+	public abstract String stringifyValue();
+
+	public abstract void dump(DataOutputStream dos) throws IOException;
+
+	public static final int STRING = 's';
+
+	public static final int ENUM_CONSTANT = 'e';
+
+	public static final int CLASS = 'c';
+
+	public static final int ANNOTATION = '@';
+
+	public static final int ARRAY = '[';
+
+	public static final int PRIMITIVE_INT = 'I';
+
+	public static final int PRIMITIVE_BYTE = 'B';
+
+	public static final int PRIMITIVE_CHAR = 'C';
+
+	public static final int PRIMITIVE_DOUBLE = 'D';
+
+	public static final int PRIMITIVE_FLOAT = 'F';
+
+	public static final int PRIMITIVE_LONG = 'J';
+
+	public static final int PRIMITIVE_SHORT = 'S';
+
+	public static final int PRIMITIVE_BOOLEAN = 'Z';
+
+	public static ElementValue readElementValue(DataInputStream dis,
+			ConstantPool cpool) throws IOException
+	{
+		byte type = dis.readByte();
+		switch (type)
+		{
+		case 'B': // byte
+			return new SimpleElementValue(PRIMITIVE_BYTE, dis
+					.readUnsignedShort(), cpool);
+		case 'C': // char
+			return new SimpleElementValue(PRIMITIVE_CHAR, dis
+					.readUnsignedShort(), cpool);
+		case 'D': // double
+			return new SimpleElementValue(PRIMITIVE_DOUBLE, dis
+					.readUnsignedShort(), cpool);
+		case 'F': // float
+			return new SimpleElementValue(PRIMITIVE_FLOAT, dis
+					.readUnsignedShort(), cpool);
+		case 'I': // int
+			return new SimpleElementValue(PRIMITIVE_INT, dis
+					.readUnsignedShort(), cpool);
+		case 'J': // long
+			return new SimpleElementValue(PRIMITIVE_LONG, dis
+					.readUnsignedShort(), cpool);
+		case 'S': // short
+			return new SimpleElementValue(PRIMITIVE_SHORT, dis
+					.readUnsignedShort(), cpool);
+		case 'Z': // boolean
+			return new SimpleElementValue(PRIMITIVE_BOOLEAN, dis
+					.readUnsignedShort(), cpool);
+		case 's': // String
+			return new SimpleElementValue(STRING, dis.readUnsignedShort(),
+					cpool);
+		case 'e': // Enum constant
+			return new EnumElementValue(ENUM_CONSTANT, dis.readUnsignedShort(),
+					dis.readUnsignedShort(), cpool);
+		case 'c': // Class
+			return new ClassElementValue(CLASS, dis.readUnsignedShort(), cpool);
+		case '@': // Annotation
+			return new AnnotationElementValue(ANNOTATION, new AnnotationEntry(
+					dis, cpool), cpool);
+		case '[': // Array
+			int numArrayVals = dis.readUnsignedShort();
+			List arrayVals = new ArrayList();
+			ElementValue[] evalues = new ElementValue[numArrayVals];
+			for (int j = 0; j < numArrayVals; j++)
+			{
+				evalues[j] = ElementValue.readElementValue(dis, cpool);
+			}
+			return new ArrayElementValue(ARRAY, evalues, cpool);
+		default:
+			throw new RuntimeException(
+					"Unexpected element value kind in annotation: " + type);
+		}
+	}
+
+	public String toShortString()
+	{
+		StringBuffer result = new StringBuffer();
+		result.append(stringifyValue());
+		return result.toString();
+	}
 }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValuePair.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValuePair.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValuePair.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ElementValuePair.java Wed Jun 14 03:55:10 2006
@@ -40,6 +40,6 @@
      */
     ElementValuePair(DataInputStream file, ConstantPool constant_pool) throws IOException {
         element_name_index = (file.readUnsignedShort());
-        value = new ElementValue(file, constant_pool);
+        value = ElementValue.readElementValue(file, constant_pool);
     }
 }

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EnumElementValue.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EnumElementValue.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EnumElementValue.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EnumElementValue.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,62 @@
+package org.apache.bcel.classfile;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import org.apache.bcel.Constants;
+
+public class EnumElementValue extends ElementValue
+{
+	// For enum types, these two indices point to the type and value
+	private int typeIdx;
+
+	private int valueIdx;
+
+	public EnumElementValue(int type, int typeIdx, int valueIdx,
+			ConstantPool cpool)
+	{
+		super(type, cpool);
+		if (type != ENUM_CONSTANT)
+			throw new RuntimeException(
+					"Only element values of type enum can be built with this ctor");
+		this.typeIdx = typeIdx;
+		this.valueIdx = valueIdx;
+	}
+
+	public void dump(DataOutputStream dos) throws IOException
+	{
+		dos.writeByte(type); // u1 type of value (ENUM_CONSTANT == 'e')
+		dos.writeShort(typeIdx); // u2
+		dos.writeShort(valueIdx); // u2
+	}
+
+	public String stringifyValue()
+	{
+		ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(valueIdx,
+				Constants.CONSTANT_Utf8);
+		return cu8.getBytes();
+	}
+
+	public String getEnumTypeString()
+	{
+		ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(typeIdx,
+				Constants.CONSTANT_Utf8);
+		return cu8.getBytes();// Utility.signatureToString(cu8.getBytes());
+	}
+
+	public String getEnumValueString()
+	{
+		ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(valueIdx,
+				Constants.CONSTANT_Utf8);
+		return cu8.getBytes();
+	}
+
+	public int getValueIndex()
+	{
+		return valueIdx;
+	}
+
+	public int getTypeIndex()
+	{
+		return typeIdx;
+	}
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EnumElementValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EnumElementValue.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,209 @@
+/*
+ * Copyright  2000-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.bcel.classfile;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import org.apache.bcel.Constants;
+
+public class SimpleElementValue extends ElementValue
+{
+	private int index;
+
+	protected SimpleElementValue(int type, int index, ConstantPool cpool)
+	{
+		super(type, cpool);
+		this.index = index;
+	}
+
+	/**
+	 * @return Value entry index in the cpool
+	 */
+	public int getIndex()
+	{
+		return index;
+	}
+
+	public void setIndex(int index)
+	{
+		this.index = index;
+	}
+
+	public String getValueString()
+	{
+		if (type != STRING)
+			throw new RuntimeException(
+					"Dont call getValueString() on a non STRING ElementValue");
+		ConstantUtf8 c = (ConstantUtf8) cpool.getConstant(getIndex(),
+				Constants.CONSTANT_Utf8);
+		return c.getBytes();
+	}
+
+	public int getValueInt()
+	{
+		if (type != PRIMITIVE_INT)
+			throw new RuntimeException(
+					"Dont call getValueString() on a non STRING ElementValue");
+		ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+				Constants.CONSTANT_Integer);
+		return c.getBytes();
+	}
+
+	public byte getValueByte()
+	{
+		if (type != PRIMITIVE_BYTE)
+			throw new RuntimeException(
+					"Dont call getValueByte() on a non BYTE ElementValue");
+		ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+				Constants.CONSTANT_Integer);
+		return (byte) c.getBytes();
+	}
+
+	public char getValueChar()
+	{
+		if (type != PRIMITIVE_CHAR)
+			throw new RuntimeException(
+					"Dont call getValueChar() on a non CHAR ElementValue");
+		ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+				Constants.CONSTANT_Integer);
+		return (char) c.getBytes();
+	}
+
+	public long getValueLong()
+	{
+		if (type != PRIMITIVE_LONG)
+			throw new RuntimeException(
+					"Dont call getValueLong() on a non LONG ElementValue");
+		ConstantLong j = (ConstantLong) cpool.getConstant(getIndex());
+		return j.getBytes();
+	}
+
+	public float getValueFloat()
+	{
+		if (type != PRIMITIVE_FLOAT)
+			throw new RuntimeException(
+					"Dont call getValueFloat() on a non FLOAT ElementValue");
+		ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex());
+		return f.getBytes();
+	}
+
+	public double getValueDouble()
+	{
+		if (type != PRIMITIVE_DOUBLE)
+			throw new RuntimeException(
+					"Dont call getValueDouble() on a non DOUBLE ElementValue");
+		ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex());
+		return d.getBytes();
+	}
+
+	public boolean getValueBoolean()
+	{
+		if (type != PRIMITIVE_BOOLEAN)
+			throw new RuntimeException(
+					"Dont call getValueBoolean() on a non BOOLEAN ElementValue");
+		ConstantInteger bo = (ConstantInteger) cpool.getConstant(getIndex());
+		return (bo.getBytes() != 0);
+	}
+
+	public short getValueShort()
+	{
+		if (type != PRIMITIVE_SHORT)
+			throw new RuntimeException(
+					"Dont call getValueShort() on a non SHORT ElementValue");
+		ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex());
+		return (short) s.getBytes();
+	}
+
+	public String toString()
+	{
+		return stringifyValue();
+	}
+
+	// Whatever kind of value it is, return it as a string
+	public String stringifyValue()
+	{
+		switch (type)
+		{
+		case PRIMITIVE_INT:
+			ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+					Constants.CONSTANT_Integer);
+			return Integer.toString(c.getBytes());
+		case PRIMITIVE_LONG:
+			ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(),
+					Constants.CONSTANT_Long);
+			return Long.toString(j.getBytes());
+		case PRIMITIVE_DOUBLE:
+			ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
+					Constants.CONSTANT_Double);
+			return Double.toString(d.getBytes());
+		case PRIMITIVE_FLOAT:
+			ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(),
+					Constants.CONSTANT_Float);
+			return Float.toString(f.getBytes());
+		case PRIMITIVE_SHORT:
+			ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(),
+					Constants.CONSTANT_Integer);
+			return Integer.toString(s.getBytes());
+		case PRIMITIVE_BYTE:
+			ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(),
+					Constants.CONSTANT_Integer);
+			return Integer.toString(b.getBytes());
+		case PRIMITIVE_CHAR:
+			ConstantInteger ch = (ConstantInteger) cpool.getConstant(
+					getIndex(), Constants.CONSTANT_Integer);
+			return new Character((char) ch.getBytes()).toString();
+		case PRIMITIVE_BOOLEAN:
+			ConstantInteger bo = (ConstantInteger) cpool.getConstant(
+					getIndex(), Constants.CONSTANT_Integer);
+			if (bo.getBytes() == 0)
+				return "false";
+			if (bo.getBytes() != 0)
+				return "true";
+		case STRING:
+			ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(),
+					Constants.CONSTANT_Utf8);
+			return cu8.getBytes();
+		default:
+			throw new RuntimeException(
+					"SimpleElementValue class does not know how to stringify type "
+							+ type);
+		}
+	}
+
+	public void dump(DataOutputStream dos) throws IOException
+	{
+		dos.writeByte(type); // u1 kind of value
+		switch (type)
+		{
+		case PRIMITIVE_INT:
+		case PRIMITIVE_BYTE:
+		case PRIMITIVE_CHAR:
+		case PRIMITIVE_FLOAT:
+		case PRIMITIVE_LONG:
+		case PRIMITIVE_BOOLEAN:
+		case PRIMITIVE_SHORT:
+		case PRIMITIVE_DOUBLE:
+		case STRING:
+			dos.writeShort(getIndex());
+			break;
+		default:
+			throw new RuntimeException(
+					"SimpleElementValue doesnt know how to write out type "
+							+ type);
+		}
+	}
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/SimpleElementValue.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationGen.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationGen.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationGen.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationGen.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,5 @@
+package org.apache.bcel.generic;
+
+public class AnnotationGen
+{
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationGen.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/AnnotationGen.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementNameValuePairGen.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementNameValuePairGen.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementNameValuePairGen.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementNameValuePairGen.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,5 @@
+package org.apache.bcel.generic;
+
+public class ElementNameValuePairGen
+{
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementNameValuePairGen.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementNameValuePairGen.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,164 @@
+package org.apache.bcel.generic;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import org.apache.bcel.classfile.AnnotationElementValue;
+import org.apache.bcel.classfile.ArrayElementValue;
+import org.apache.bcel.classfile.ClassElementValue;
+import org.apache.bcel.classfile.ElementValue;
+import org.apache.bcel.classfile.EnumElementValue;
+import org.apache.bcel.classfile.SimpleElementValue;
+
+public abstract class ElementValueGen
+{
+	protected int type;
+
+	protected ConstantPoolGen cpGen;
+
+	protected ElementValueGen(int type, ConstantPoolGen cpGen)
+	{
+		this.type = type;
+		this.cpGen = cpGen;
+	}
+
+	/**
+	 * Subtypes return an immutable variant of the ElementValueGen
+	 */
+	public abstract ElementValue getElementValue();
+
+	public int getElementValueType()
+	{
+		return type;
+	}
+
+	public abstract String stringifyValue();
+
+	public abstract void dump(DataOutputStream dos) throws IOException;
+
+	public static final int STRING = 's';
+
+	public static final int ENUM_CONSTANT = 'e';
+
+	public static final int CLASS = 'c';
+
+	public static final int ANNOTATION = '@';
+
+	public static final int ARRAY = '[';
+
+	public static final int PRIMITIVE_INT = 'I';
+
+	public static final int PRIMITIVE_BYTE = 'B';
+
+	public static final int PRIMITIVE_CHAR = 'C';
+
+	public static final int PRIMITIVE_DOUBLE = 'D';
+
+	public static final int PRIMITIVE_FLOAT = 'F';
+
+	public static final int PRIMITIVE_LONG = 'J';
+
+	public static final int PRIMITIVE_SHORT = 'S';
+
+	public static final int PRIMITIVE_BOOLEAN = 'Z';
+
+	public static ElementValueGen readElementValue(DataInputStream dis,
+			ConstantPoolGen cpGen) throws IOException
+	{
+		int type = dis.readUnsignedByte();
+		switch (type)
+		{
+		case 'B': // byte
+			return new SimpleElementValueGen(PRIMITIVE_BYTE, dis
+					.readUnsignedShort(), cpGen);
+		case 'C': // char
+			return new SimpleElementValueGen(PRIMITIVE_CHAR, dis
+					.readUnsignedShort(), cpGen);
+		case 'D': // double
+			return new SimpleElementValueGen(PRIMITIVE_DOUBLE, dis
+					.readUnsignedShort(), cpGen);
+		case 'F': // float
+			return new SimpleElementValueGen(PRIMITIVE_FLOAT, dis
+					.readUnsignedShort(), cpGen);
+		case 'I': // int
+			return new SimpleElementValueGen(PRIMITIVE_INT, dis
+					.readUnsignedShort(), cpGen);
+		case 'J': // long
+			return new SimpleElementValueGen(PRIMITIVE_LONG, dis
+					.readUnsignedShort(), cpGen);
+		case 'S': // short
+			return new SimpleElementValueGen(PRIMITIVE_SHORT, dis
+					.readUnsignedShort(), cpGen);
+		case 'Z': // boolean
+			return new SimpleElementValueGen(PRIMITIVE_BOOLEAN, dis
+					.readUnsignedShort(), cpGen);
+		case 's': // String
+			return new SimpleElementValueGen(STRING, dis.readUnsignedShort(),
+					cpGen);
+		case 'e': // Enum constant
+			return new EnumElementValueGen(dis.readUnsignedShort(), dis
+					.readUnsignedShort(), cpGen);
+		case 'c': // Class
+			return new ClassElementValueGen(dis.readUnsignedShort(), cpGen);
+			//
+			// case '@': // Annotation
+			// return new
+			// AnnotationElementValueGen(ANNOTATION,Annotation.read(dis,cpGen),cpGen);
+			//		  	
+			// case '[': // Array
+			// int numArrayVals = dis.readUnsignedShort();
+			// List arrayVals = new ArrayList();
+			// ElementValue[] evalues = new ElementValue[numArrayVals];
+			// for (int j=0;j<numArrayVals;j++) {
+			// evalues[j] = ElementValue.readElementValue(dis,cpGen);
+			// }
+			// return new ArrayElementValue(ARRAY,evalues,cpGen);
+		default:
+			throw new RuntimeException(
+					"Unexpected element value kind in annotation: " + type);
+		}
+	}
+
+	protected ConstantPoolGen getConstantPool()
+	{
+		return cpGen;
+	}
+
+	/**
+	 * Creates an (modifiable) ElementValueGen copy of an (immutable)
+	 * ElementValue - constant pool is assumed correct.
+	 */
+	public static ElementValueGen copy(ElementValue value,
+			ConstantPoolGen cpool, boolean copyPoolEntries)
+	{
+		switch (value.getElementValueType())
+		{
+		case 'B': // byte
+		case 'C': // char
+		case 'D': // double
+		case 'F': // float
+		case 'I': // int
+		case 'J': // long
+		case 'S': // short
+		case 'Z': // boolean
+		case 's': // String
+			return new SimpleElementValueGen((SimpleElementValue) value, cpool,
+					copyPoolEntries);
+		case 'e': // Enum constant
+			return new EnumElementValueGen((EnumElementValue) value, cpool,
+					copyPoolEntries);
+		case '@': // Annotation
+			return new AnnotationElementValueGen(
+					(AnnotationElementValue) value, cpool, copyPoolEntries);
+		case '[': // Array
+			return new ArrayElementValueGen((ArrayElementValue) value, cpool,
+					copyPoolEntries);
+		case 'c': // Class
+			return new ClassElementValueGen((ClassElementValue) value, cpool,
+					copyPoolEntries);
+		default:
+			throw new RuntimeException("Not implemented yet! ("
+					+ value.getElementValueType() + ")");
+		}
+	}
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ElementValueGen.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java (added)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,5 @@
+package org.apache.bcel.generic;
+
+public class SimpleElementValueGen extends ElementValueGen
+{
+}

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/SimpleElementValueGen.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractCounterVisitorTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractCounterVisitorTestCase.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractCounterVisitorTestCase.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractCounterVisitorTestCase.java Wed Jun 14 03:55:10 2006
@@ -1,11 +1,10 @@
 package org.apache.bcel;
 
-import junit.framework.TestCase;
 import org.apache.bcel.classfile.DescendingVisitor;
 import org.apache.bcel.classfile.JavaClass;
 import org.apache.bcel.visitors.CounterVisitor;
 
-public abstract class AbstractCounterVisitorTestCase extends TestCase
+public abstract class AbstractCounterVisitorTestCase extends AbstractTestCase
 {
 	protected abstract JavaClass getTestClass() throws ClassNotFoundException;
 

Added: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java (added)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,48 @@
+package org.apache.bcel;
+
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.TestCase;
+import org.apache.bcel.classfile.Attribute;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Method;
+import org.apache.bcel.util.SyntheticRepository;
+
+public class AbstractTestCase extends TestCase
+{
+	private boolean verbose = false;
+
+	protected JavaClass getTestClass(String name) throws ClassNotFoundException
+	{
+		return SyntheticRepository.getInstance().loadClass(name);
+	}
+
+	protected Method getMethod(JavaClass cl, String methodname)
+	{
+		Method[] methods = cl.getMethods();
+		for (int i = 0; i < methods.length; i++)
+		{
+			Method m = methods[i];
+			if (m.getName().equals(methodname))
+			{
+				return m;
+			}
+		}
+		return null;
+	}
+
+	protected Attribute findAttribute(String name, Attribute[] all)
+	{
+		List chosenAttrsList = new ArrayList();
+		for (int i = 0; i < all.length; i++)
+		{
+			if (verbose)
+				System.err.println("Attribute: " + all[i].getName());
+			if (all[i].getName().equals(name))
+				chosenAttrsList.add(all[i]);
+		}
+		assertTrue("Should be one match: " + chosenAttrsList.size(),
+				chosenAttrsList.size() == 1);
+		return (Attribute) chosenAttrsList.get(0);
+	}
+}

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AbstractTestCase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationAccessFlagTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationAccessFlagTestCase.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationAccessFlagTestCase.java (added)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationAccessFlagTestCase.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,23 @@
+package org.apache.bcel;
+
+import org.apache.bcel.classfile.JavaClass;
+
+public class AnnotationAccessFlagTestCase extends AbstractTestCase
+{
+	/**
+	 * If you write an annotation and compile it, the class file generated
+	 * should be marked as an annotation type - which is detectable through
+	 * BCEL.
+	 */
+	public void testAnnotationClassSaysItIs() throws ClassNotFoundException
+	{
+		JavaClass clazz = getTestClass("org.apache.bcel.data.SimpleAnnotation");
+		assertTrue(
+				"Expected SimpleAnnotation class to say it was an annotation - but it didn't !",
+				clazz.isAnnotation());
+		clazz = getTestClass("org.apache.bcel.data.SimpleClass");
+		assertTrue(
+				"Expected SimpleClass class to say it was not an annotation - but it didn't !",
+				!clazz.isAnnotation());
+	}
+}

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationAccessFlagTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationAccessFlagTestCase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationDefaultAttributeTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationDefaultAttributeTestCase.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationDefaultAttributeTestCase.java (added)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationDefaultAttributeTestCase.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,28 @@
+package org.apache.bcel;
+
+import org.apache.bcel.classfile.AnnotationDefault;
+import org.apache.bcel.classfile.ElementValue;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Method;
+import org.apache.bcel.classfile.SimpleElementValue;
+
+public class AnnotationDefaultAttributeTestCase extends AbstractTestCase
+{
+	/**
+	 * For values in an annotation that have default values, we should be able
+	 * to query the AnnotationDefault attribute against the method to discover
+	 * the default value that was originally declared.
+	 */
+	public void testMethodAnnotations() throws ClassNotFoundException
+	{
+		JavaClass clazz = getTestClass("org.apache.bcel.data.SimpleAnnotation");
+		Method m = getMethod(clazz, "fruit");
+		AnnotationDefault a = (AnnotationDefault) findAttribute(
+				"AnnotationDefault", m.getAttributes());
+		SimpleElementValue val = (SimpleElementValue) a.getDefaultValue();
+		assertTrue("Should be STRING but is " + val.getElementValueType(), val
+				.getElementValueType() == ElementValue.STRING);
+		assertTrue("Should have default of bananas but default is "
+				+ val.getValueString(), val.getValueString().equals("bananas"));
+	}
+}

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationDefaultAttributeTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationDefaultAttributeTestCase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java (added)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,162 @@
+package org.apache.bcel;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+import org.apache.bcel.classfile.Attribute;
+import org.apache.bcel.classfile.RuntimeInvisibleAnnotations;
+import org.apache.bcel.classfile.RuntimeVisibleAnnotations;
+import org.apache.bcel.classfile.Utility;
+import org.apache.bcel.generic.AnnotationGen;
+import org.apache.bcel.generic.ClassGen;
+import org.apache.bcel.generic.ConstantPoolGen;
+import org.apache.bcel.generic.ElementNameValuePairGen;
+import org.apache.bcel.generic.ElementValueGen;
+import org.apache.bcel.generic.ObjectType;
+import org.apache.bcel.generic.SimpleElementValueGen;
+
+public class AnnotationGenTestCase extends AbstractTestCase
+{
+	private ClassGen createClassGen(String classname)
+	{
+		return new ClassGen(classname, "java.lang.Object", "<generated>",
+				Constants.ACC_PUBLIC | Constants.ACC_SUPER, null);
+	}
+
+	/**
+	 * Programmatically construct an mutable annotation (AnnotationGen) object.
+	 */
+	public void testConstructMutableAnnotation()
+	{
+		// Create the containing class
+		ClassGen cg = createClassGen("HelloWorld");
+		ConstantPoolGen cp = cg.getConstantPool();
+		// Create the simple primitive value '4' of type 'int'
+		SimpleElementValueGen evg = new SimpleElementValueGen(
+				ElementValueGen.PRIMITIVE_INT, cp, 4);
+		// Give it a name, call it 'id'
+		ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg,
+				cp);
+		// Check it looks right
+		assertTrue(
+				"Should include string 'id=4' but says: " + nvGen.toString(),
+				nvGen.toString().indexOf("id=4") != -1);
+		ObjectType t = new ObjectType("SimpleAnnotation");
+		List elements = new ArrayList();
+		elements.add(nvGen);
+		// Build an annotation of type 'SimpleAnnotation' with 'id=4' as the
+		// only value :)
+		AnnotationGen a = new AnnotationGen(t, elements, true, cp);
+		// Check we can save and load it ok
+		checkSerialize(a, cp);
+	}
+
+	public void testVisibleInvisibleAnnotationGen()
+	{
+		// Create the containing class
+		ClassGen cg = createClassGen("HelloWorld");
+		ConstantPoolGen cp = cg.getConstantPool();
+		// Create the simple primitive value '4' of type 'int'
+		SimpleElementValueGen evg = new SimpleElementValueGen(
+				ElementValueGen.PRIMITIVE_INT, cp, 4);
+		// Give it a name, call it 'id'
+		ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg,
+				cp);
+		// Check it looks right
+		assertTrue(
+				"Should include string 'id=4' but says: " + nvGen.toString(),
+				nvGen.toString().indexOf("id=4") != -1);
+		ObjectType t = new ObjectType("SimpleAnnotation");
+		List elements = new ArrayList();
+		elements.add(nvGen);
+		// Build a RV annotation of type 'SimpleAnnotation' with 'id=4' as the
+		// only value :)
+		AnnotationGen a = new AnnotationGen(t, elements, true, cp);
+		Vector v = new Vector();
+		v.add(a);
+		Attribute[] attributes = Utility.getAnnotationAttributes(cp, v);
+		boolean foundRV = false;
+		for (int i = 0; i < attributes.length; i++)
+		{
+			Attribute attribute = attributes[i];
+			if (attribute instanceof RuntimeVisibleAnnotations)
+			{
+				assertTrue(((RuntimeAnnotations) attribute).areVisible());
+				foundRV = true;
+			}
+		}
+		assertTrue("Should have seen a RuntimeVisibleAnnotation", foundRV);
+		// Build a RIV annotation of type 'SimpleAnnotation' with 'id=4' as the
+		// only value :)
+		AnnotationGen a2 = new AnnotationGen(t, elements, false, cp);
+		Vector v2 = new Vector();
+		v2.add(a2);
+		Attribute[] attributes2 = Utility.getAnnotationAttributes(cp, v2);
+		boolean foundRIV = false;
+		for (int i = 0; i < attributes2.length; i++)
+		{
+			Attribute attribute = attributes2[i];
+			if (attribute instanceof RuntimeInvisibleAnnotations)
+			{
+				assertFalse(((RuntimeAnnotations) attribute).areVisible());
+				foundRIV = true;
+			}
+		}
+		assertTrue("Should have seen a RuntimeInvisibleAnnotation", foundRIV);
+	}
+
+	private void checkSerialize(AnnotationGen a, ConstantPoolGen cpg)
+	{
+		try
+		{
+			String beforeName = a.getTypeName();
+			List beforeValues = a.getValues();
+			ByteArrayOutputStream baos = new ByteArrayOutputStream();
+			DataOutputStream dos = new DataOutputStream(baos);
+			a.dump(dos);
+			dos.flush();
+			dos.close();
+			byte[] bs = baos.toByteArray();
+			ByteArrayInputStream bais = new ByteArrayInputStream(bs);
+			DataInputStream dis = new DataInputStream(bais);
+			AnnotationGen annAfter = AnnotationGen.read(dis, cpg, a
+					.isRuntimeVisible());
+			dis.close();
+			String afterName = annAfter.getTypeName();
+			List afterValues = annAfter.getValues();
+			if (!beforeName.equals(afterName))
+			{
+				fail("Deserialization failed: before type='" + beforeName
+						+ "' after type='" + afterName + "'");
+			}
+			if (a.getValues().size() != annAfter.getValues().size())
+			{
+				fail("Different numbers of element name value pairs?? "
+						+ a.getValues().size() + "!="
+						+ annAfter.getValues().size());
+			}
+			for (int i = 0; i < a.getValues().size(); i++)
+			{
+				ElementNameValuePairGen beforeElement = (ElementNameValuePairGen) a
+						.getValues().get(i);
+				ElementNameValuePairGen afterElement = (ElementNameValuePairGen) annAfter
+						.getValues().get(i);
+				if (!beforeElement.getNameString().equals(
+						afterElement.getNameString()))
+				{
+					fail("Different names?? " + beforeElement.getNameString()
+							+ "!=" + afterElement.getNameString());
+				}
+			}
+		}
+		catch (IOException ioe)
+		{
+			fail("Unexpected exception whilst checking serialization: " + ioe);
+		}
+	}
+}

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/AnnotationGenTestCase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/CounterVisitorTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/CounterVisitorTestCase.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/CounterVisitorTestCase.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/CounterVisitorTestCase.java Wed Jun 14 03:55:10 2006
@@ -1,266 +1,265 @@
 package org.apache.bcel;
 
 import org.apache.bcel.classfile.JavaClass;
-import org.apache.bcel.util.ClassPath;
-import org.apache.bcel.util.SyntheticRepository;
 
 public class CounterVisitorTestCase extends AbstractCounterVisitorTestCase
 {
 	protected JavaClass getTestClass() throws ClassNotFoundException
 	{
-		JavaClass javaClass = SyntheticRepository.getInstance(
-				new ClassPath(
-						"file://F:/GSoC/Dmitriy/bcel-j5/target/test-classes/"))
-				.loadClass("org.apache.bcel.data.package-info");
-		System.out.println(javaClass.isAbstract());
-		return javaClass;
+		return getTestClass("org.apache.bcel.data.MarkedType$1");
 	}
 
 	public void testAnnotationsCount()
 	{
-		System.out
-				.println("AnnotationsCount = " + getVisitor().annotationCount);
+		// System.out
+		// .println("AnnotationsCount = " + getVisitor().annotationCount);
 		assertTrue(getVisitor().annotationCount == 2);
 	}
 
 	public void testAnnotationDefaultCount()
 	{
-		System.out.println("AnnotationDefaultCount = "
-				+ getVisitor().annotationDefaultCount);
+		// System.out.println("AnnotationDefaultCount = "
+		// + getVisitor().annotationDefaultCount);
 		assertTrue(getVisitor().annotationDefaultCount == 0);
 	}
 
 	public void testAnnotationEntryCount()
 	{
-		System.out.println("AnnotationEntryCount = "
-				+ getVisitor().annotationEntryCount);
+		// System.out.println("AnnotationEntryCount = "
+		// + getVisitor().annotationEntryCount);
 		assertTrue(getVisitor().annotationEntryCount == 0);
 	}
 
 	public void testCodeCount()
 	{
-		System.out.println("CodeCount = " + getVisitor().codeCount);
+		// System.out.println("CodeCount = " + getVisitor().codeCount);
 		assertTrue(getVisitor().codeCount == 1);
 	}
 
 	public void testCodeExceptionCount()
 	{
-		System.out.println("CodeExceptionCount = "
-				+ getVisitor().codeExceptionCount);
+		// System.out.println("CodeExceptionCount = "
+		// + getVisitor().codeExceptionCount);
 		assertTrue(getVisitor().codeExceptionCount == 0);
 	}
 
 	public void testConstantClassCount()
 	{
-		System.out.println("ConstantClassCount = "
-				+ getVisitor().constantClassCount);
+		// System.out.println("ConstantClassCount = "
+		// + getVisitor().constantClassCount);
 		assertTrue(getVisitor().constantClassCount == 2);
 	}
 
 	public void testConstantDoubleCount()
 	{
-		System.out.println("ConstantDoubleCount = "
-				+ getVisitor().constantDoubleCount);
+		// System.out.println("ConstantDoubleCount = "
+		// + getVisitor().constantDoubleCount);
 		assertTrue(getVisitor().constantDoubleCount == 0);
 	}
 
 	public void testConstantFieldrefCount()
 	{
-		System.out.println("ConstantFieldrefCount = "
-				+ getVisitor().constantFieldrefCount);
+		// System.out.println("ConstantFieldrefCount = "
+		// + getVisitor().constantFieldrefCount);
 		assertTrue(getVisitor().constantFieldrefCount == 0);
 	}
 
 	public void testConstantFloatCount()
 	{
-		System.out.println("ConstantFloatCount = "
-				+ getVisitor().constantFloatCount);
+		// System.out.println("ConstantFloatCount = "
+		// + getVisitor().constantFloatCount);
 		assertTrue(getVisitor().constantFloatCount == 0);
 	}
 
 	public void testConstantIntegerCount()
 	{
-		System.out.println("ConstantIntegerCount = "
-				+ getVisitor().constantIntegerCount);
+		// System.out.println("ConstantIntegerCount = "
+		// + getVisitor().constantIntegerCount);
 		assertTrue(getVisitor().constantIntegerCount == 0);
 	}
 
 	public void testConstantInterfaceMethodrefCount()
 	{
-		System.out.println("ConstantInterfaceMethodrefCount = "
-				+ getVisitor().constantInterfaceMethodrefCount);
+		// System.out.println("ConstantInterfaceMethodrefCount = "
+		// + getVisitor().constantInterfaceMethodrefCount);
 		assertTrue(getVisitor().constantInterfaceMethodrefCount == 0);
 	}
 
 	public void testConstantLongCount()
 	{
-		System.out.println("ConstantLongCount = "
-				+ getVisitor().constantLongCount);
+		// System.out.println("ConstantLongCount = "
+		// + getVisitor().constantLongCount);
 		assertTrue(getVisitor().constantLongCount == 0);
 	}
 
 	public void testConstantMethodrefCount()
 	{
-		System.out.println("ConstantMethodrefCount = "
-				+ getVisitor().constantMethodrefCount);
+		// System.out.println("ConstantMethodrefCount = "
+		// + getVisitor().constantMethodrefCount);
 		assertTrue(getVisitor().constantMethodrefCount == 1);
 	}
 
 	public void testConstantNameAndTypeCount()
 	{
-		System.out.println("ConstantNameAndTypeCount = "
-				+ getVisitor().constantNameAndTypeCount);
+		// System.out.println("ConstantNameAndTypeCount = "
+		// + getVisitor().constantNameAndTypeCount);
 		assertTrue(getVisitor().constantNameAndTypeCount == 1);
 	}
 
 	public void testConstantPoolCount()
 	{
-		System.out.println("ConstantPoolCount = "
-				+ getVisitor().constantPoolCount);
+		// System.out.println("ConstantPoolCount = "
+		// + getVisitor().constantPoolCount);
 		assertTrue(getVisitor().constantPoolCount == 1);
 	}
 
 	public void testConstantStringCount()
 	{
-		System.out.println("ConstantStringCount = "
-				+ getVisitor().constantStringCount);
+		// System.out.println("ConstantStringCount = "
+		// + getVisitor().constantStringCount);
 		assertTrue(getVisitor().constantStringCount == 0);
 	}
 
 	public void testConstantValueCount()
 	{
-		System.out.println("ConstantValueCount = "
-				+ getVisitor().constantValueCount);
+		// System.out.println("ConstantValueCount = "
+		// + getVisitor().constantValueCount);
 		assertTrue(getVisitor().constantValueCount == 0);
 	}
 
 	public void testDeprecatedCount()
 	{
-		System.out.println("DeprecatedCount = " + getVisitor().deprecatedCount);
+		// System.out.println("DeprecatedCount = " +
+		// getVisitor().deprecatedCount);
 		assertTrue(getVisitor().deprecatedCount == 0);
 	}
 
 	public void testEnclosingMethodCount()
 	{
-		System.out.println("EnclosingMethodCount = "
-				+ getVisitor().enclosingMethodCount);
+		// System.out.println("EnclosingMethodCount = "
+		// + getVisitor().enclosingMethodCount);
 		assertTrue(getVisitor().enclosingMethodCount == 0);
 	}
 
 	public void testExceptionTableCount()
 	{
-		System.out.println("ExceptionTableCount = "
-				+ getVisitor().exceptionTableCount);
+		// System.out.println("ExceptionTableCount = "
+		// + getVisitor().exceptionTableCount);
 		assertTrue(getVisitor().exceptionTableCount == 0);
 	}
 
 	public void testFieldCount()
 	{
-		System.out.println("FieldCount = " + getVisitor().fieldCount);
+		// System.out.println("FieldCount = " + getVisitor().fieldCount);
 		assertTrue(getVisitor().fieldCount == 0);
 	}
 
 	public void testInnerClassCount()
 	{
-		System.out.println("InnerClassCount = " + getVisitor().innerClassCount);
+		// System.out.println("InnerClassCount = " +
+		// getVisitor().innerClassCount);
 		assertTrue(getVisitor().innerClassCount == 0);
 	}
 
 	public void testInnerClassesCount()
 	{
-		System.out.println("InnerClassesCount = "
-				+ getVisitor().innerClassesCount);
+		// System.out.println("InnerClassesCount = "
+		// + getVisitor().innerClassesCount);
 		assertTrue(getVisitor().innerClassesCount == 0);
 	}
 
 	public void testJavaClassCount()
 	{
-		System.out.println("JavaClassCount = " + getVisitor().javaClassCount);
+		// System.out.println("JavaClassCount = " +
+		// getVisitor().javaClassCount);
 		assertTrue(getVisitor().javaClassCount == 1);
 	}
 
 	public void testLineNumberCount()
 	{
-		System.out.println("LineNumberCount = " + getVisitor().lineNumberCount);
+		// System.out.println("LineNumberCount = " +
+		// getVisitor().lineNumberCount);
 		assertTrue(getVisitor().lineNumberCount == 1);
 	}
 
 	public void testLineNumberTableCount()
 	{
-		System.out.println("LineNumberTableCount = "
-				+ getVisitor().lineNumberTableCount);
+		// System.out.println("LineNumberTableCount = "
+		// + getVisitor().lineNumberTableCount);
 		assertTrue(getVisitor().lineNumberTableCount == 1);
 	}
 
 	public void testLocalVariableCount()
 	{
-		System.out.println("LocalVariableCount = "
-				+ getVisitor().localVariableCount);
+		// System.out.println("LocalVariableCount = "
+		// + getVisitor().localVariableCount);
 		assertTrue(getVisitor().localVariableCount == 1);
 	}
 
 	public void testLocalVariableTableCount()
 	{
-		System.out.println("LocalVariableTableCount = "
-				+ getVisitor().localVariableTableCount);
+		// System.out.println("LocalVariableTableCount = "
+		// + getVisitor().localVariableTableCount);
 		assertTrue(getVisitor().localVariableTableCount == 1);
 	}
 
 	public void testLocalVariableTypeTableCount()
 	{
-		System.out.println("LocalVariableTypeTableCount = "
-				+ getVisitor().localVariableTypeTableCount);
+		// System.out.println("LocalVariableTypeTableCount = "
+		// + getVisitor().localVariableTypeTableCount);
 		assertTrue(getVisitor().localVariableTypeTableCount == 0);
 	}
 
 	public void testMethodCount()
 	{
-		System.out.println("MethodCount = " + getVisitor().methodCount);
+		// System.out.println("MethodCount = " + getVisitor().methodCount);
 		assertTrue(getVisitor().methodCount == 1);
 	}
 
 	public void testParameterAnnotationCount()
 	{
-		System.out.println("ParameterAnnotationCount = "
-				+ getVisitor().methodCount);
+		// System.out.println("ParameterAnnotationCount = "
+		// + getVisitor().methodCount);
 		assertTrue(getVisitor().methodCount == 1);
 	}
 
 	public void testSignatureCount()
 	{
-		System.out.println("SignatureCount = "
-				+ getVisitor().signatureAnnotationCount);
+		// System.out.println("SignatureCount = "
+		// + getVisitor().signatureAnnotationCount);
 		assertTrue(getVisitor().signatureAnnotationCount == 0);
 	}
 
 	public void testSourceFileCount()
 	{
-		System.out.println("SourceFileCount = " + getVisitor().sourceFileCount);
+		// System.out.println("SourceFileCount = " +
+		// getVisitor().sourceFileCount);
 		assertTrue(getVisitor().sourceFileCount == 1);
 	}
 
 	public void testStackMapCount()
 	{
-		System.out.println("StackMapCount = " + getVisitor().stackMapCount);
+		// System.out.println("StackMapCount = " + getVisitor().stackMapCount);
 		assertTrue(getVisitor().stackMapCount == 0);
 	}
 
 	public void testStackMapEntryCount()
 	{
-		System.out.println("StackMapEntryCount = "
-				+ getVisitor().stackMapEntryCount);
+		// System.out.println("StackMapEntryCount = "
+		// + getVisitor().stackMapEntryCount);
 		assertTrue(getVisitor().stackMapEntryCount == 0);
 	}
 
 	public void testSyntheticCount()
 	{
-		System.out.println("SyntheticCount = " + getVisitor().syntheticCount);
+		// System.out.println("SyntheticCount = " +
+		// getVisitor().syntheticCount);
 		assertTrue(getVisitor().syntheticCount == 0);
 	}
 
 	public void testUnknownCount()
 	{
-		System.out.println("UnknownCount = " + getVisitor().unknownCount);
+		// System.out.println("UnknownCount = " + getVisitor().unknownCount);
 		assertTrue(getVisitor().unknownCount == 0);
 	}
 }

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkedType.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkedType.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkedType.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkedType.java Wed Jun 14 03:55:10 2006
@@ -1,48 +0,0 @@
-package org.apache.bcel.data;
-
-@MarkerAnnotationInvisible
-@MarkerAnnotation
-@SimpleAnnotation(id = 1)
-public abstract class MarkedType
-{
-	@MarkerAnnotationInvisible
-	@MarkerAnnotation
-	class InnerClass
-	{
-	}
-
-	@MarkerAnnotationInvisible
-	@MarkerAnnotation
-	int annotatedField;
-
-	@Deprecated
-	void deprecatedMthod()
-	{
-	}
-
-	native void nativeMthod();
-
-	abstract void abstractMethod();
-
-	@MarkerAnnotationInvisible
-	@MarkerAnnotation
-	void annotatedMethod()
-	{
-	}
-
-	void annotatedParamentrMethod(@MarkerAnnotationInvisible
-	@MarkerAnnotation
-	int i)
-	{
-	}
-
-	void constantedMethod()
-	{
-		int i1 = 1;
-		int i2 = 200000;
-		long l1 = 1;
-		long l2 = 200000;
-		float f = 0.1F;
-		String s = "";
-	}
-}

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotation.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotation.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotation.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotation.java Wed Jun 14 03:55:10 2006
@@ -1,10 +0,0 @@
-package org.apache.bcel.data;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface MarkerAnnotation
-{
-	String value() default "";
-}

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotationInvisible.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotationInvisible.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotationInvisible.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/MarkerAnnotationInvisible.java Wed Jun 14 03:55:10 2006
@@ -1,9 +0,0 @@
-package org.apache.bcel.data;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.CLASS)
-public @interface MarkerAnnotationInvisible
-{
-}

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleAnnotation.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleAnnotation.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleAnnotation.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleAnnotation.java Wed Jun 14 03:55:10 2006
@@ -1,10 +1,11 @@
 package org.apache.bcel.data;
 
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.RUNTIME)
-public @interface SimpleAnnotation {
-  int id();
-  String fruit() default "bananas";
+public @interface SimpleAnnotation
+{
+	int id();
+
+	String fruit() default "bananas";
 }

Added: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleClass.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleClass.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleClass.java (added)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleClass.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,9 @@
+package org.apache.bcel.data;
+
+public class SimpleClass
+{
+	public static void main(String[] argv)
+	{
+		// Nothing unusual in this class
+	}
+}

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleClass.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleEnum.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleEnum.java?rev=414190&view=auto
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleEnum.java (added)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleEnum.java Wed Jun 14 03:55:10 2006
@@ -0,0 +1,3 @@
+package org.apache.bcel.data;
+
+public enum SimpleEnum { Red,Orange,Yellow,Green,Blue,Indigo,Violet };

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleEnum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/SimpleEnum.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/package-info.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/package-info.java?rev=414190&r1=414189&r2=414190&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/package-info.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/data/package-info.java Wed Jun 14 03:55:10 2006
@@ -1,4 +0,0 @@
-@MarkerAnnotationInvisible
-@MarkerAnnotation
-@SimpleAnnotation(id = 1)
-package org.apache.bcel.data;
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.