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

Shigeru Chiba chiba at is.titech.ac.jp
Sat Nov 11 21:43:15 EST 2006


  User: chiba   
  Date: 06/11/11 21:43:15

  Modified:    src/main/javassist/convert  TransformCall.java
  Log:
  enabled a transformation from a public method call to a private method call by CodeConverter
  
  Revision  Changes    Path
  1.9       +8 -1      javassist/src/main/javassist/convert/TransformCall.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TransformCall.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/convert/TransformCall.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- TransformCall.java	25 Aug 2006 18:41:32 -0000	1.8
  +++ TransformCall.java	12 Nov 2006 02:43:15 -0000	1.9
  @@ -17,11 +17,13 @@
   
   import javassist.CtClass;
   import javassist.CtMethod;
  +import javassist.Modifier;
   import javassist.bytecode.*;
   
   public class TransformCall extends Transformer {
       protected String classname, methodname, methodDescriptor;
       protected String newClassname, newMethodname;
  +    protected boolean newMethodIsPrivate;
   
       /* cache */
       protected int newIndex;
  @@ -43,6 +45,7 @@
           classname = newClassname = substMethod.getDeclaringClass().getName(); 
           newMethodname = substMethod.getName();
           constPool = null;
  +        newMethodIsPrivate = Modifier.isPrivate(substMethod.getModifiers());
       }
   
       public void initialize(ConstPool cp, CodeAttribute attr) {
  @@ -79,8 +82,12 @@
               int ci = cp.addClassInfo(newClassname);
               if (c == INVOKEINTERFACE)
                   newIndex = cp.addInterfaceMethodrefInfo(ci, nt);
  -            else
  +            else {
  +                if (newMethodIsPrivate && c == INVOKEVIRTUAL)
  +                    iterator.writeByte(INVOKESPECIAL, pos);
  +
                   newIndex = cp.addMethodrefInfo(ci, nt);
  +            }
   
               constPool = cp;
           }
  
  
  



More information about the jboss-cvs-commits mailing list