You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by db...@apache.org on 2005/02/13 04:15:10 UTC

svn commit: r153590 - in jakarta/bcel/trunk/src/java/org/apache/bcel: ./ classfile/

Author: dbrosius
Date: Sat Feb 12 19:15:08 2005
New Revision: 153590

URL: http://svn.apache.org/viewcvs?view=rev&rev=153590
Log:
Initial implementation for Annotations. This code is currently not used, as the break out of Attributes for Annotations is commented out in Attributes.read. The ElementValue class will be derived from to support the different ElementValue types, for now it's an icky 'union' class. The "Parameter' type of Annotations are to be added next.

Added:
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationEntry.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Annotations.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValue.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValuePair.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeInvisibleAnnotations.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeVisibleAnnotations.java
Modified:
    jakarta/bcel/trunk/src/java/org/apache/bcel/Constants.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Attribute.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/DescendingVisitor.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Visitor.java

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/Constants.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/Constants.java?view=diff&r1=153589&r2=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/Constants.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/Constants.java Sat Feb 12 19:15:08 2005
@@ -698,27 +698,30 @@
 
   /** Attributes and their corresponding names.
    */
-  public static final byte ATTR_UNKNOWN              = -1;
-  public static final byte ATTR_SOURCE_FILE          = 0;
-  public static final byte ATTR_CONSTANT_VALUE       = 1;
-  public static final byte ATTR_CODE                 = 2;
-  public static final byte ATTR_EXCEPTIONS           = 3;
-  public static final byte ATTR_LINE_NUMBER_TABLE    = 4;
-  public static final byte ATTR_LOCAL_VARIABLE_TABLE = 5;
-  public static final byte ATTR_INNER_CLASSES        = 6;
-  public static final byte ATTR_SYNTHETIC            = 7;
-  public static final byte ATTR_DEPRECATED           = 8;
-  public static final byte ATTR_PMG                  = 9;
-  public static final byte ATTR_SIGNATURE            = 10;
-  public static final byte ATTR_STACK_MAP            = 11;
+  public static final byte ATTR_UNKNOWN                       = -1;
+  public static final byte ATTR_SOURCE_FILE                   = 0;
+  public static final byte ATTR_CONSTANT_VALUE                = 1;
+  public static final byte ATTR_CODE                          = 2;
+  public static final byte ATTR_EXCEPTIONS                    = 3;
+  public static final byte ATTR_LINE_NUMBER_TABLE             = 4;
+  public static final byte ATTR_LOCAL_VARIABLE_TABLE          = 5;
+  public static final byte ATTR_INNER_CLASSES                 = 6;
+  public static final byte ATTR_SYNTHETIC                     = 7;
+  public static final byte ATTR_DEPRECATED                    = 8;
+  public static final byte ATTR_PMG                           = 9;
+  public static final byte ATTR_SIGNATURE                     = 10;
+  public static final byte ATTR_STACK_MAP                     = 11;
+  public static final byte ATTR_RUNTIMEVISIBLE_ANNOTATIONS    = 12;
+  public static final byte ATTR_RUNTIMEINVISIBLE_ANNOTATIONS  = 13;
 
-  public static final short KNOWN_ATTRIBUTES = 12;
+  public static final short KNOWN_ATTRIBUTES = 14;
 
   public static final String[] ATTRIBUTE_NAMES = {
     "SourceFile", "ConstantValue", "Code", "Exceptions",
     "LineNumberTable", "LocalVariableTable",
     "InnerClasses", "Synthetic", "Deprecated",
-    "PMGClass", "Signature", "StackMap"
+    "PMGClass", "Signature", "StackMap", 
+    "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations"
   };
 
   /** Constants used in the StackMap attribute.

Added: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationEntry.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationEntry.java?view=auto&rev=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationEntry.java (added)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationEntry.java Sat Feb 12 19:15:08 2005
@@ -0,0 +1,85 @@
+/*
+ * 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.DataInputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Constants;
+
+
+/**
+ * represents one annotation in the annotation table
+ * 
+ * @version $Id: AnnotationEntry
+ * @author  <A HREF="mailto:dbrosius@qis.net">D. Brosius</A>
+ */
+public class AnnotationEntry implements Node, Constants
+{
+	private int type_index;
+	private int num_element_value_pairs;
+	private ElementValuePair[] element_value_pairs;
+	private ConstantPool constant_pool;
+	
+	/**
+	 * Construct object from file stream.
+	 * @param file Input stream
+	 * @throws IOException
+	 */
+	AnnotationEntry(DataInputStream file, ConstantPool constant_pool)
+	       throws IOException
+	{
+		type_index = (file.readUnsignedShort());
+		num_element_value_pairs = (file.readUnsignedShort());
+
+		element_value_pairs = new ElementValuePair[num_element_value_pairs];
+	    for(int i=0; i < num_element_value_pairs; i++)
+	    	element_value_pairs[i] = new ElementValuePair(file, constant_pool);
+	    this.constant_pool = constant_pool;
+	}
+	
+	  /**
+	   * Called by objects that are traversing the nodes of the tree implicitely
+	   * defined by the contents of a Java class. I.e., the hierarchy of methods,
+	   * fields, attributes, etc. spawns a tree of objects.
+	   *
+	   * @param v Visitor object
+	   */
+	  public void accept(Visitor v) {
+	    v.visitAnnotationEntry(this);
+	  }
+	  
+	  /**
+	   * @return the annotation type name
+	   */   
+	  public String getAnnotationType() {
+	      ConstantUtf8  c;
+
+	      c = (ConstantUtf8)constant_pool.getConstant(type_index, CONSTANT_Utf8);
+	      return c.getBytes();  	
+	  }
+	  
+	  /**
+	   * @returns the number of element value pairs in this annotation entry
+	   */
+	  public final int getNumElementValuePairs() { return num_element_value_pairs; }
+	  
+	  /**
+	   * @return the element value pairs in this annotation entry
+	   */
+	  public ElementValuePair[] getElementValuePairs() { return element_value_pairs; }
+}

Added: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Annotations.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Annotations.java?view=auto&rev=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Annotations.java (added)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Annotations.java Sat Feb 12 19:15:08 2005
@@ -0,0 +1,108 @@
+/*
+ * 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.DataInputStream;
+import java.io.IOException;
+
+import  org.apache.bcel.Constants;
+
+/**
+ * base class for annotations
+ * 
+ * @version $Id: Annotations
+ * @author  <A HREF="mailto:dbrosius@qis.net">D. Brosius</A>
+ */
+public abstract class Annotations extends Attribute {
+
+	private int               annotation_table_length; 
+	private AnnotationEntry[] annotation_table;        // Table of annotations
+
+	/**
+	 * @param annotation_type the subclass type of the annotation
+	 * @param name_index Index pointing to the name <em>Code</em>
+	 * @param length Content length in bytes
+	 * @param file Input stream
+	 * @param constant_pool Array of constants
+	 */
+	Annotations(byte annotation_type, int name_index, int length, DataInputStream file,
+       ConstantPool constant_pool) throws IOException
+    {
+	    this(annotation_type, name_index, length, (AnnotationEntry[]) null, constant_pool);   
+	    
+	    annotation_table_length = (file.readUnsignedShort());
+	    annotation_table = new AnnotationEntry[annotation_table_length];
+
+	    for(int i=0; i < annotation_table_length; i++)
+	    	annotation_table[i] = new AnnotationEntry(file, constant_pool);
+	}
+	
+	/**
+	 * @param annotation_type the subclass type of the annotation
+	 * @param name_index Index pointing to the name <em>Code</em>
+	 * @param length Content length in bytes
+	 * @param annotation_table the actual annotations
+	 * @param constant_pool Array of constants
+	 */
+	 public Annotations(byte annotation_type, int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool)
+	 {
+	    super(annotation_type, name_index, length, constant_pool);
+	    setAnnotationTable(annotation_table);
+
+	 }
+	 	  
+	  /**
+	   * Called by objects that are traversing the nodes of the tree implicitely
+	   * defined by the contents of a Java class. I.e., the hierarchy of methods,
+	   * fields, attributes, etc. spawns a tree of objects.
+	   *
+	   * @param v Visitor object
+	   */
+	  public void accept(Visitor v) {
+	    v.visitAnnotation(this);
+	  }
+	  
+	  /**
+	   * @param annotation_table the entries to set in this annotation
+	   */
+	  public final void setAnnotationTable(AnnotationEntry[] annotation_table)
+	  {
+	    this.annotation_table = annotation_table;
+	    annotation_table_length = (annotation_table == null)? 0 :
+	    	annotation_table.length;
+	  }
+
+	  /**
+	   * @returns the annotation entry table
+	   */
+	  public final AnnotationEntry[] GetAnnotationTable()
+	  {
+	    return annotation_table;
+	  }
+	  
+	  /**
+	   * returns the array of annotation entries in this annotation
+	   */
+	  public AnnotationEntry[] getAnnotationEntries() {
+	  	return annotation_table;
+	  }
+	  
+	  /**
+	   * @returns the number of annotation entries in this annotation
+	   */
+	  public final int getNumAnnotation() { return annotation_table_length; }
+}

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Attribute.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Attribute.java?view=diff&r1=153589&r2=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Attribute.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Attribute.java Sat Feb 12 19:15:08 2005
@@ -183,6 +183,12 @@
     case Constants.ATTR_STACK_MAP:
       return new StackMap(name_index, length, file, constant_pool);
 
+//    case Constants.ATTR_RUNTIMEVISIBLE_ANNOTATIONS:
+//        return new RuntimeVisibleAnnotations(name_index, length, file, constant_pool);
+        
+//    case Constants.ATTR_RUNTIMEINVISIBLE_ANNOTATIONS:
+//      return new RuntimeInvisibleAnnotations(name_index, length, file, constant_pool);
+      
     default: // Never reached
       throw new IllegalStateException("Ooops! default case reached.");
     }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/DescendingVisitor.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/DescendingVisitor.java?view=diff&r1=153589&r2=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/DescendingVisitor.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/DescendingVisitor.java Sat Feb 12 19:15:08 2005
@@ -91,6 +91,22 @@
     stack.pop();
   }
 
+  public void visitAnnotation(Annotations annotation) {
+  	stack.push(annotation);
+  	annotation.accept(visitor);
+  	
+  	AnnotationEntry[] entries = annotation.getAnnotationEntries();
+  	for (int i=0; i < entries.length; i++)
+  		entries[i].accept(this);
+  	stack.pop();
+  }
+  
+  public void visitAnnotationEntry(AnnotationEntry annotationEntry) {
+  	stack.push(annotationEntry);
+  	annotationEntry.accept(visitor);
+  	stack.pop();
+  }
+
   public void visitField(Field field) {
     stack.push(field);
     field.accept(visitor);

Added: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValue.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValue.java?view=auto&rev=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValue.java (added)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValue.java Sat Feb 12 19:15:08 2005
@@ -0,0 +1,87 @@
+/*
+ * 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.DataInputStream;
+import java.io.IOException;
+
+/**
+ * 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:dbrosius@qis.net">D. Brosius</A>
+ */
+
+public class ElementValue
+{
+	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 );				
+		}
+	}
+}

Added: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValuePair.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValuePair.java?view=auto&rev=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValuePair.java (added)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/ElementValuePair.java Sat Feb 12 19:15:08 2005
@@ -0,0 +1,46 @@
+/*
+ * 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.DataInputStream;
+import java.io.IOException;
+
+
+/**
+ * an annotation's element value pair
+ * 
+ * @version $Id: ElementValuePair
+ * @author  <A HREF="mailto:dbrosius@qis.net">D. Brosius</A>
+ */
+public class ElementValuePair
+{
+	private int element_name_index;
+	private ElementValue value;
+
+	/**
+	 * Construct object from file stream.
+	 * @param file Input stream
+	 * @param constant_pool the constant pool
+	 * @throws IOException
+	 */
+	ElementValuePair(DataInputStream file, ConstantPool constant_pool)
+	       throws IOException
+	{
+		element_name_index = (file.readUnsignedShort());
+		value = new ElementValue(file, constant_pool);
+	}
+}

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java?view=diff&r1=153589&r2=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java Sat Feb 12 19:15:08 2005
@@ -31,6 +31,8 @@
 public class EmptyVisitor implements Visitor {
   protected EmptyVisitor() { }
 
+  public void visitAnnotation(Annotations obj) {}
+  public void visitAnnotationEntry(AnnotationEntry obj) {}
   public void visitCode(Code obj) {}
   public void visitCodeException(CodeException obj) {}
   public void visitConstantClass(ConstantClass obj) {}

Added: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeInvisibleAnnotations.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeInvisibleAnnotations.java?view=auto&rev=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeInvisibleAnnotations.java (added)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeInvisibleAnnotations.java Sat Feb 12 19:15:08 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright  2000-2005 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.DataInputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Constants;
+
+/**
+ * represents an annotation that is represented in the class file
+ * but is not provided to the JVM.
+ * 
+ * @version $Id: RuntimeInvisibleAnnotations
+ * @author  <A HREF="mailto:dbrosius@qis.net">D. Brosius</A>
+ */
+public class RuntimeInvisibleAnnotations extends Annotations
+{
+	/**
+	 * @param name_index Index pointing to the name <em>Code</em>
+	 * @param length Content length in bytes
+	 * @param file Input stream
+	 * @param constant_pool Array of constants
+	 */
+	RuntimeInvisibleAnnotations(int name_index, int length, DataInputStream file,
+       ConstantPool constant_pool) throws IOException
+    {
+	    super(Constants.ATTR_RUNTIMEINVISIBLE_ANNOTATIONS, name_index, length, file, constant_pool);    
+	}
+
+	/**
+	 * @return deep copy of this attribute
+	 */
+	public Attribute copy(ConstantPool constant_pool) {
+	    Annotations c = (Annotations)clone();
+	  
+	    return c;
+	}	 
+
+}

Added: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeVisibleAnnotations.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeVisibleAnnotations.java?view=auto&rev=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeVisibleAnnotations.java (added)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/RuntimeVisibleAnnotations.java Sat Feb 12 19:15:08 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright  2000-2005 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.DataInputStream;
+import java.io.IOException;
+
+import org.apache.bcel.Constants;
+
+/**
+ * represents an annotation that is represented in the class file
+ * and is provided to the JVM.
+ * 
+ * @version $Id: RuntimeVisibleAnnotations
+ * @author  <A HREF="mailto:dbrosius@qis.net">D. Brosius</A>
+ */
+public class RuntimeVisibleAnnotations extends Annotations
+{
+	/**
+	 * @param name_index Index pointing to the name <em>Code</em>
+	 * @param length Content length in bytes
+	 * @param file Input stream
+	 * @param constant_pool Array of constants
+	 */
+	RuntimeVisibleAnnotations(int name_index, int length, DataInputStream file,
+       ConstantPool constant_pool) throws IOException
+    {
+	    super(Constants.ATTR_RUNTIMEVISIBLE_ANNOTATIONS, name_index, length, file, constant_pool);    
+	}
+
+	/**
+	 * @return deep copy of this attribute
+	 */
+	public Attribute copy(ConstantPool constant_pool) {
+	    Annotations c = (Annotations)clone();
+	  
+	    return c;
+	}	 
+
+}

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Visitor.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Visitor.java?view=diff&r1=153589&r2=153590
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Visitor.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Visitor.java Sat Feb 12 19:15:08 2005
@@ -29,6 +29,8 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public interface Visitor {
+  public void visitAnnotation(Annotations obj);
+  public void visitAnnotationEntry(AnnotationEntry obj);
   public void visitCode(Code obj);    
   public void visitCodeException(CodeException obj);    
   public void visitConstantClass(ConstantClass obj);    



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org