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

Shigeru Chiba chiba at is.titech.ac.jp
Thu Jul 19 06:21:26 EDT 2007


  User: chiba   
  Date: 07/07/19 06:21:26

  Modified:    src/main/javassist/bytecode  ConstPool.java
  Log:
  modified redirectMethodCall() in CodeConverter
  
  Revision  Changes    Path
  1.24      +57 -1     javassist/src/main/javassist/bytecode/ConstPool.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConstPool.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/ConstPool.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -b -r1.23 -r1.24
  --- ConstPool.java	4 Jun 2007 03:11:09 -0000	1.23
  +++ ConstPool.java	19 Jul 2007 10:21:26 -0000	1.24
  @@ -207,6 +207,34 @@
   
       /**
        * Reads the <code>class_index</code> field of the
  +     * <code>CONSTANT_Fieldref_info</code>,
  +     * <code>CONSTANT_Methodref_info</code>,
  +     * or <code>CONSTANT_Interfaceref_info</code>,
  +     * structure at the given index.
  +     *
  +     * @since 3.6
  +     */
  +    public int getMemberClass(int index) {
  +        MemberrefInfo minfo = (MemberrefInfo)getItem(index);
  +        return minfo.classIndex;
  +    }
  +
  +    /**
  +     * Reads the <code>name_and_type_index</code> field of the
  +     * <code>CONSTANT_Fieldref_info</code>,
  +     * <code>CONSTANT_Methodref_info</code>,
  +     * or <code>CONSTANT_Interfaceref_info</code>,
  +     * structure at the given index.
  +     *
  +     * @since 3.6
  +     */
  +    public int getMemberNameAndType(int index) {
  +        MemberrefInfo minfo = (MemberrefInfo)getItem(index);
  +        return minfo.nameAndTypeIndex;
  +    }
  +
  +    /**
  +     * Reads the <code>class_index</code> field of the
        * <code>CONSTANT_Fieldref_info</code> structure
        * at the given index.
        */
  @@ -274,7 +302,7 @@
           if (f == null)
               return null;
           else {
  -            NameAndTypeInfo n = (NameAndTypeInfo) getItem(f.nameAndTypeIndex);
  +            NameAndTypeInfo n = (NameAndTypeInfo)getItem(f.nameAndTypeIndex);
               if(n == null)
                   return null;
               else
  @@ -579,6 +607,34 @@
           return 0;       // false
       }
   
  +    /**
  +     * Determines whether <code>CONSTANT_Methodref_info</code>,
  +     * <code>CONSTANT_Fieldref_info</code>, or
  +     * <code>CONSTANT_InterfaceMethodref_info</code> structure
  +     * at the given index has the name and the descriptor
  +     * given as the arguments.
  +     *
  +     * @param membername        the member name
  +     * @param desc              the descriptor of the member.
  +     * @param index             the index into the constant pool table
  +     *
  +     * @return          the name of the target class specified by
  +     *                  the <code>..._info</code> structure
  +     *                  at <code>index</code>.
  +     *                  Otherwise, null if that structure does not 
  +     *                  match the given member name and descriptor.
  +     */
  +    public String eqMember(String membername, String desc, int index) {
  +        MemberrefInfo minfo = (MemberrefInfo)getItem(index);
  +        NameAndTypeInfo ntinfo
  +                = (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex);
  +        if (getUtf8Info(ntinfo.memberName).equals(membername)
  +            && getUtf8Info(ntinfo.typeDescriptor).equals(desc))
  +            return getClassInfo(minfo.classIndex);
  +        else
  +            return null;       // false
  +    }
  +
       private int addItem(ConstInfo info) {
           items.addElement(info);
           return numOfItems++;
  
  
  



More information about the jboss-cvs-commits mailing list