You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by prashant pandit <pr...@yahoo.com> on 2006/08/23 09:56:32 UTC
Constructor modification using BCEL
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.
Re: Constructor modification using BCEL
Posted by Vanesa Montagna <va...@gmail.com>.
Me gustaria ayudarte pero no entiendo que necesitas, no manejo muy bien el
ingles, nesecitas modificar el constructor de una clase ????
Saludos
Vanesa
2006/8/23, prashant pandit <pr...@yahoo.com>:
>
> 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.
>