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

Shigeru Chiba chiba at is.titech.ac.jp
Mon Nov 6 23:19:37 EST 2006


  User: chiba   
  Date: 06/11/06 23:19:37

  Modified:    src/main/javassist/bytecode   ClassFile.java
  Added:       src/main/javassist/bytecode   DuplicateMemberException.java
  Log:
  Fixed a bug of duplicating writeReplace() to a proxy class.
  
  Revision  Changes    Path
  1.28      +10 -6     javassist/src/main/javassist/bytecode/ClassFile.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClassFile.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/ClassFile.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- ClassFile.java	5 Nov 2006 23:16:35 -0000	1.27
  +++ ClassFile.java	7 Nov 2006 04:19:37 -0000	1.28
  @@ -465,8 +465,10 @@
   
       /**
        * Appends a field to the class.
  +     *
  +     * @throws DuplicateMemberException         when the field is already included.
        */
  -    public void addField(FieldInfo finfo) throws CannotCompileException {
  +    public void addField(FieldInfo finfo) throws DuplicateMemberException {
           testExistingField(finfo.getName(), finfo.getDescriptor());
           fields.add(finfo);
       }
  @@ -476,12 +478,12 @@
       }
   
       private void testExistingField(String name, String descriptor)
  -            throws CannotCompileException {
  +            throws DuplicateMemberException {
           ListIterator it = fields.listIterator(0);
           while (it.hasNext()) {
               FieldInfo minfo = (FieldInfo)it.next();
               if (minfo.getName().equals(name))
  -                throw new CannotCompileException("duplicate field: " + name);
  +                throw new DuplicateMemberException("duplicate field: " + name);
           }
       }
   
  @@ -523,8 +525,10 @@
   
       /**
        * Appends a method to the class.
  +     *
  +     * @throws DuplicateMemberException         when the method is already included.
        */
  -    public void addMethod(MethodInfo minfo) throws CannotCompileException {
  +    public void addMethod(MethodInfo minfo) throws DuplicateMemberException {
           testExistingMethod(minfo);
           methods.add(minfo);
       }
  @@ -534,7 +538,7 @@
       }
   
       private void testExistingMethod(MethodInfo newMinfo)
  -        throws CannotCompileException
  +        throws DuplicateMemberException
       {
           String name = newMinfo.getName();
           String descriptor = newMinfo.getDescriptor();
  @@ -545,7 +549,7 @@
                       && notBridgeMethod(minfo) && notBridgeMethod(newMinfo)
                       && Descriptor.eqParamTypes(minfo.getDescriptor(),
                                                  descriptor))
  -                throw new CannotCompileException("duplicate method: " + name
  +                throw new DuplicateMemberException("duplicate method: " + name
                                                    + " in " + this.getName());
           }
       }
  
  
  
  1.1      date: 2006/11/07 04:19:37;  author: chiba;  state: Exp;javassist/src/main/javassist/bytecode/DuplicateMemberException.java
  
  Index: DuplicateMemberException.java
  ===================================================================
  /*
   * Javassist, a Java-bytecode translator toolkit.
   * Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.
   *
   * The contents of this file are subject to the Mozilla Public License Version
   * 1.1 (the "License"); you may not use this file except in compliance with
   * the License.  Alternatively, the contents of this file may be used under
   * the terms of the GNU Lesser General Public License Version 2.1 or later.
   *
   * Software distributed under the License is distributed on an "AS IS" basis,
   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   * for the specific language governing rights and limitations under the
   * License.
   */
  
  package javassist.bytecode;
  
  import javassist.CannotCompileException;
  
  /**
   * An exception thrown when adding a duplicate member is requested.
   *
   * @see ClassFile#addMethod(MethodInfo)
   * @see ClassFile#addField(FieldInfo)
   */
  public class DuplicateMemberException extends CannotCompileException {
      public DuplicateMemberException(String msg) {
          super(msg);
      }
  }
  
  
  



More information about the jboss-cvs-commits mailing list