[jboss-cvs] javassist/src/main/javassist/bytecode ...

Shigeru Chiba chiba at is.titech.ac.jp
Tue Oct 31 21:45:05 EST 2006


  User: chiba   
  Date: 06/10/31 21:45:05

  Modified:    src/main/javassist/bytecode   StackMapTable.java
                        AttributeInfo.java
  Log:
  fixed JIRA JASSIST-28?
  
  Revision  Changes    Path
  1.2       +40 -51    javassist/src/main/javassist/bytecode/StackMapTable.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StackMapTable.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/StackMapTable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- StackMapTable.java	29 Oct 2006 23:33:15 -0000	1.1
  +++ StackMapTable.java	1 Nov 2006 02:45:05 -0000	1.2
  @@ -19,6 +19,7 @@
   import java.io.DataOutputStream;
   import java.io.IOException;
   import java.util.Map;
  +import java.util.ArrayList;
   
   /**
    * <code>stack_map</code> attribute.
  @@ -33,7 +34,7 @@
        */
       public static final String tag = "StackMapTable";
   
  -    private StackMapFrame[] entries;    // may be null
  +    private ArrayList entries;    // ArrayList<StackMapFrame>.  may be null.
   
       /**
        * Constructs a <code>stack_map</code> attribute.
  @@ -73,7 +74,12 @@
       private void parseMap() {
           byte[] data = info;
           int n = ByteArray.readU16bit(data, 0);
  -        entries = new StackMapFrame[n];
  +        entries = new ArrayList(n);
  +        int offset = 2;
  +        while (n-- > 0) {
  +            int frameType;
  +        }
  +
       }
   
       private void toByteArray(boolean clear) {
  @@ -82,9 +88,21 @@
       }
   
       /**
  -     * <code>union stack_map_frame</code>
  +     * <code>union stack_map_frame</code>.
  +     * <p><code>verification_type_info</code> is represented
  +     * by a pair of two <code>int</code> values.  No class
  +     * for represening <code>verification_type_ 
  +     */
  +    public static class StackMapFrame {
  +        /**
  +         * <code>u2 offset_delta</code>.
  +         * If <code>offset_delta</code> is not included
  +         * (i.e. <code>same_frame</code>), the value of
  +         * this field is computed from other members such
  +         * as <code>frame_type</code>. 
        */
  -    public static class StackMapFrame {} 
  +        public int offsetDelta;
  +    } 
   
       /*
        * verification_type_info is represented by a pair of
  @@ -138,24 +156,22 @@
   
       /**
        * <code>same_frame</code>.
  -     * The frame has exactly the same locals as the previous
  -     * stack map frame.
  +     * <code>frame_type</code> is not included.
  +     * It is computed by <code>offsetDelta</code>. 
        */
       public static class SameFrame extends StackMapFrame {
           /**
            * The maximum value of <code>SAME</code>.
            */
           public static final int FRAME_TYPE_MAX = 63;
  -
  -        /**
  -         * <code>u1 frame_type</code>.
  -         */
  -        public int frameType;
       }
   
       /**
        * <code>same_locals_1_stack_item_frame</code> or 
        * <code>same_locals_1_stack_item_frame_extended</code>. 
  +     *
  +     * <p><code>frame_type</code> is not included.
  +     * It is computed by <code>offsetDelta</code>. 
        */
       public static class SameLocals extends StackMapFrame {
           /**
  @@ -173,15 +189,6 @@
            */
           public static final int FRAME_TYPE_EXTENDED = 247;
   
  -        /*
  -         * <code>frame_type</code> is computed by offsetDelta.
  -         */
  -
  -        /**
  -         * <code>u2 offset_delta</code>.
  -         */
  -        public int offsetDelta;
  -
           /**
            * <code>stack[0].tag</code>.
            */
  @@ -211,11 +218,6 @@
            * <code>u1 frame_type</code>.
            */
           public int frameType;
  -
  -        /**
  -         * <code>u2 offset_delta</code>.
  -         */
  -        public int offsetDelta;
       }
   
       /**
  @@ -226,11 +228,6 @@
            * <code>SAME_FRAME_EXTENDED</code>.
            */
           public static final int FRAME_TYPE = 251;
  -
  -        /**
  -         * <code>u2 offset_delta</code>.
  -         */
  -        public int offsetDelta;
       }
   
       /**
  @@ -253,17 +250,16 @@
           public int frameType;
   
           /**
  -         * <code>u2 offset_delta</code>.
  -         */
  -        public int offsetDelta;
  -
  -        /**
            * <code>locals[?].tag</code>.
  +         * <code>typeTags.length</code> and <code>typeValues.length</code>
  +         * are equal to <code>number_of_locals</code>.
            */
           public int[] typeTags;
   
           /**
            * <code>locals[?].cpool_index</code> or <code>locals[?].offset</code>.
  +         * <code>typeTags.length</code> and <code>typeValues.length</code>
  +         * are equal to <code>number_of_locals</code>.
            */
           public int[] typeValues;
       }
  @@ -278,37 +274,30 @@
           public static final int FRAME_TYPE = 255;
   
           /**
  -         * <code>u2 offset_delta</code>.
  -         */
  -        public int offsetDelta;
  -
  -        /**
  -         * <code>u2 number_of_locals</code>.
  -         */
  -        public int numOfLocals;
  -
  -        /**
            * <code>locals[?].tag</code>.
  +         * <code>typeTags.length</code> and <code>typeValues.length</code>
  +         * are equal to <code>number_of_locals</code>.
            */
           public int[] typeTags;
   
           /**
            * <code>locals[?].cpool_index</code> or <code>locals[?].offset</code>.
  +         * <code>typeTags.length</code> and <code>typeValues.length</code>
  +         * are equal to <code>number_of_locals</code>.
            */
           public int[] typeValues;
   
           /**
  -         * <code>u2 number_of_stack_items</code>.
  -         */
  -        public int numOfStackItems;
  -
  -        /**
            * <code>stack[?].tag</code>.
  +         * <code>stackTypeTags.length</code> and <code>stackTypeValues.length</code>
  +         * are equal to <code>number_of_stack_items</code>.
            */
           public int[] stackTypeTags;
   
           /**
            * <code>stack[?].cpool_index</code> or <code>locals[?].offset</code>.
  +         * <code>stackTypeTags.length</code> and <code>stackTypeValues.length</code>
  +         * are equal to <code>number_of_stack_items</code>.
            */
           public int[] stackTypeValues;
       }
  
  
  
  1.15      +3 -1      javassist/src/main/javassist/bytecode/AttributeInfo.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AttributeInfo.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/AttributeInfo.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- AttributeInfo.java	29 Oct 2006 23:33:15 -0000	1.14
  +++ AttributeInfo.java	1 Nov 2006 02:45:05 -0000	1.15
  @@ -96,8 +96,10 @@
                        || nameStr.equals(LocalVariableAttribute.typeTag))
                   return new LocalVariableAttribute(cp, name, in);
               else if (nameStr.equals(AnnotationsAttribute.visibleTag)
  -                     || nameStr.equals(AnnotationsAttribute.invisibleTag))
  +                     || nameStr.equals(AnnotationsAttribute.invisibleTag)) {
  +                // RuntimeVisibleAnnotations or RuntimeInvisibleAnnotations
                   return new AnnotationsAttribute(cp, name, in);
  +            }
               else if (nameStr.equals(ParameterAnnotationsAttribute.visibleTag)
                   || nameStr.equals(ParameterAnnotationsAttribute.invisibleTag))
                   return new ParameterAnnotationsAttribute(cp, name, in);
  
  
  



More information about the jboss-cvs-commits mailing list