Hi,
   
  I need help.Autually i want to incert some code to the constructor using BCEL.
   
  Eg:Orignal class
  public class HashMap extends AbstractMap
    implements Map, Cloneable, Serializable
{
  public HashMap(int i, float f)
    {
        entrySet = null;
        keySet = null;
        values = null;
        if(i < 0)
            throw new IllegalArgumentException("Illegal initial capacity: " + 
i);
        if(i > 0x40000000)
            i = 0x40000000;
        if(f <= 0.0F || Float.isNaN(f))
            throw new IllegalArgumentException("Illegal load factor: " + f);
        int j;
        for(j = 1; j < i; j <<= 1);
        loadFactor = f;
        threshold = (int)((float)j * f);
        table = new Entry[j];
        init();
    }
  }
   
  After modification using  BCEL
  public class HashMap extends AbstractMap
    implements Map, Cloneable, Serializable
{
  public HashMap(int i, float f)
    {
        entrySet = null;
        keySet = null;
        values = null;
        if(i < 0)
            throw new IllegalArgumentException("Illegal initial capacity: " + 
i);
        if(i > 0x40000000)
            i = 0x40000000;
        if(f <= 0.0F || Float.isNaN(f))
            throw new IllegalArgumentException("Illegal load factor: " + f);
        int j;
        for(j = 1; j < i; j <<= 1);
        loadFactor = f;
        threshold = (int)((float)j * f);
        table = new Entry[j];
        init();
  abc.getSomeMethod(this,obj1);// added during constructor transforming
    }
  }
   
  Please help me out.
   
  regards,
  Prashant

                                
---------------------------------
Want to be your own boss? Learn how on  Yahoo! Small Business. 

Reply via email to