Mime-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Bugs item #988787, was opened at 2004-07-11 05:43
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=988787&group_id=22866
Category: Javassist
Group: CVS HEAD
Status: Open
Resolution: None
Priority: 5
Submitted By: tymu (tymu)
Assigned to: Shigeru Chiba (chiba)
Summary: CodeIterator#insertGap0() is not fine.
Initial Comment:
I use with my class file, which has constant pool over
0x100 indexes.
When load my class which are copied method with ldc
opecode, throw CannotCompileException.
Perhaps, LineNumberAttribute#shiftPc() and
LocalVariableAttribute#shiftPc(), which are called from
CodeIterator#insertGap0() are wrong.
My class:
package example.app;
public final class Example {
private static final int INTVALUE = 100000;
private int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10;
private int i11, i12, i13, i14, i15, i16, i17, i18,
i19, i20;
private int i21, i22, i23, i24, i25, i26, i27, i28,
i29, i30;
private int i31, i32, i33, i34, i35, i36, i37, i38,
i39, i40;
public void doit() {
i1 = INTVALUE;
i2 = INTVALUE;
i3 = INTVALUE;
i4 = INTVALUE;
i5 = INTVALUE;
i6 = INTVALUE;
i7 = INTVALUE;
i8 = INTVALUE;
i9 = INTVALUE;
i10 = INTVALUE;
i11 = INTVALUE;
i12 = INTVALUE;
i13 = INTVALUE;
i14 = INTVALUE;
i15 = INTVALUE;
i16 = INTVALUE;
i17 = INTVALUE;
i18 = INTVALUE;
i19 = INTVALUE;
i20 = INTVALUE;
i21 = INTVALUE;
i22 = INTVALUE;
i23 = INTVALUE;
i24 = INTVALUE;
i25 = INTVALUE;
i26 = INTVALUE;
i27 = INTVALUE;
i28 = INTVALUE;
i29 = INTVALUE;
i20 = INTVALUE;
i21 = INTVALUE;
i22 = INTVALUE;
i23 = INTVALUE;
i24 = INTVALUE;
i25 = INTVALUE;
i26 = INTVALUE;
i27 = INTVALUE;
i28 = INTVALUE;
i29 = INTVALUE;
i30 = INTVALUE;
i31 = INTVALUE;
i32 = INTVALUE;
i33 = INTVALUE;
i34 = INTVALUE;
i35 = INTVALUE;
i36 = INTVALUE;
i37 = INTVALUE;
i38 = INTVALUE;
i39 = INTVALUE;
i40 = INTVALUE;
}
}
Test class:
package example.app;
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.CtNewMethod;
import javassist.NotFoundException;
import javassist.bytecode.CodeAttribute;
import junit.framework.TestCase;
public final class ExampleTest extends TestCase {
public void testExample() throws Throwable {
ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.get("example.app.Example");
CtMethod[] ms = cc.getDeclaredMethods();
for (int i = 0; i < ms.length; i++) {
addMethod(ms[i], cc);
}
cc.writeFile();
Class c = cc.toClass();
}
private void addMethod(CtMethod method, CtClass target)
throws CannotCompileException, NotFoundException {
CtClass[] ts = method.getParameterTypes();
CtClass[] newts = new CtClass[ts.length + 1];
for (int i = 0; i < ts.length; i++) {
newts[i] = ts[i];
}
ClassPool p =
method.getDeclaringClass().getClassPool();
newts[ts.length] = target;
CtMethod m =
CtNewMethod.make(
method.getModifiers(),
method.getReturnType(),
method.getName(),
newts,
method.getExceptionTypes(),
null,
method.getDeclaringClass());
m.setBody(method, null);
CodeAttribute ca =
m.getMethodInfo().getCodeAttribute();
ca.setMaxLocals(ca.getMaxLocals() + 1);
target.addMethod(m);
}
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=988787&group_id=22866
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development