Author: dbrosius
Date: Sun Feb 13 16:09:58 2005
New Revision: 153682

URL: http://svn.apache.org/viewcvs?view=rev&rev=153682
Log:
Add support for the Attribute - AnnotationDefault , again commented out.

Added:
    jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationDefault.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/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=153681&r2=153682
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/Constants.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/Constants.java Sun Feb 13 
16:09:58 2005
@@ -715,8 +715,9 @@
   public static final byte ATTR_RUNTIMEINVISIBLE_ANNOTATIONS                   
= 13;
   public static final byte ATTR_RUNTIMEVISIBLE_PARAMETER_ANNOTATIONS   = 14;
   public static final byte ATTR_RUNTIMEINVISIBLE_PARAMETER_ANNOTATIONS         
= 15;
+  public static final byte ATTR_ANNOTATION_DEFAULT                      = 16;
 
-  public static final short KNOWN_ATTRIBUTES = 12;//should be 16
+  public static final short KNOWN_ATTRIBUTES = 12;//should be 17
 
   public static final String[] ATTRIBUTE_NAMES = {
     "SourceFile", "ConstantValue", "Code", "Exceptions",
@@ -724,7 +725,8 @@
     "InnerClasses", "Synthetic", "Deprecated",
     "PMGClass", "Signature", "StackMap", 
     "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations",
-    "RuntimeVisibleParameterAnnotations", 
"RuntimeInvisibleParameterAnnotations"
+    "RuntimeVisibleParameterAnnotations", 
"RuntimeInvisibleParameterAnnotations",
+    "AnnotationDefault"
   };
 
   /** Constants used in the StackMap attribute.

Added: 
jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationDefault.java?view=auto&rev=153682
==============================================================================
--- 
jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationDefault.java 
(added)
+++ 
jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/AnnotationDefault.java 
Sun Feb 13 16:09:58 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;
+
+import  org.apache.bcel.Constants;
+
+/**
+ * represents the default value of a annotation for a method info
+ * 
+ * @version $Id: AnnotationDefault 1 2005-02-13 03:15:08Z dbrosius $
+ * @author  <A HREF="mailto:[EMAIL PROTECTED]">D. Brosius</A>
+ */
+public abstract class AnnotationDefault extends Attribute {
+
+       ElementValue default_value;
+
+       /**
+        * @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
+        */
+       AnnotationDefault(byte annotation_type, int name_index, int length, 
DataInputStream file,
+       ConstantPool constant_pool) throws IOException
+    {
+           this(annotation_type, name_index, length, (ElementValue) null, 
constant_pool);   
+           default_value = new ElementValue(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 defaultValue the annotation's default value
+        * @param constant_pool Array of constants
+        */
+        public AnnotationDefault(byte annotation_type, int name_index, int 
length, ElementValue defaultValue, ConstantPool constant_pool)
+        {
+           super(annotation_type, name_index, length, constant_pool);
+           setDefaultValue(defaultValue);
+        }
+                 
+         /**
+          * 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.visitAnnotationDefault(this);
+         }
+         
+         /**
+          * @param defaultValue the default value of this methodinfo's 
annotation
+          */
+         public final void setDefaultValue(ElementValue defaultValue)
+         {
+           default_value = defaultValue;
+         }
+
+         /**
+          * @returns the default value
+          */
+         public final ElementValue getDefaultValue()
+         {
+           return default_value;
+         }
+}

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=153681&r2=153682
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Attribute.java 
(original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Attribute.java Sun 
Feb 13 16:09:58 2005
@@ -195,6 +195,9 @@
 //    case Constants.ATTR_RUNTIMEINVISIBLE_PARAMETER_ANNOTATIONS:
 //      return new RuntimeInvisibleParameterAnnotations(name_index, length, 
file, constant_pool);
 
+//    case Constants.ATTR_ANNOTATION_DEFAULT:
+//      return new AnnotationDefault(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/EmptyVisitor.java
URL: 
http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java?view=diff&r1=153681&r2=153682
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java 
(original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/EmptyVisitor.java Sun 
Feb 13 16:09:58 2005
@@ -34,6 +34,7 @@
   public void visitAnnotation(Annotations obj) {}
   public void visitParameterAnnotation(ParameterAnnotations obj) {}
   public void visitAnnotationEntry(AnnotationEntry obj) {}
+  public void visitAnnotationDefault(AnnotationDefault obj) {}
   public void visitCode(Code obj) {}
   public void visitCodeException(CodeException obj) {}
   public void visitConstantClass(ConstantClass obj) {}

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=153681&r2=153682
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Visitor.java 
(original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/classfile/Visitor.java Sun Feb 
13 16:09:58 2005
@@ -32,6 +32,7 @@
   //public void visitAnnotation(Annotations obj);
   //public void visitParameterAnnotation(ParameterAnnotations obj);
   //public void visitAnnotationEntry(AnnotationEntry obj);
+  //public void visitAnnotationDefault(AnnotationDefault obj);
   public void visitCode(Code obj);    
   public void visitCodeException(CodeException obj);    
   public void visitConstantClass(ConstantClass obj);    



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to