[JBoss-user] [Javassist user questions] - Re: How to value a byte array

2006-01-27 Thread jmarranz
With minor modifications , it may be simpler class ByteArray { private byte[] array; private int counter = 0; public ByteArray(int size) { array = new byte[size]; } public ByteArray add(byte b) { array[counter]=b; counter++; return this; } public byte[] getArray()

[JBoss-user] [Javassist user questions] - Re: How to value a byte array

2006-01-27 Thread jmarranz
I have a trick to solve this problem, create a utility class like: class ByteArray { private byte[] array; public ByteArray(int size) { array = new byte[size]; } public ByteArray set(int index,byte b) { array[index]=b; return this; } public byte[] getArray() { retu

[JBoss-user] [Javassist user questions] - instrument() always recognize an array index modification as

2004-03-23 Thread jmarranz
instrument() always recognize an array index modification as read access. Example: class MyClass { private int[] a = new int[3]; public void example() { a[2] = 5; } } Using instrument() with CodeConverter detect "a[2] = " as a read field access of "a". There is no way to modi

[JBoss-user] [Javassist user questions] - instrument(ExprEditor) doesn't recognize new type[ ] as NewE

2004-03-12 Thread jmarranz
instrument(ExprEditor) doesn't recognize new type[ ] as NewExpr Example: public int[] myarray = new int[10]; is not recognized calling CtClass.instrument() and filtering with NewExpr occurrences. http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825359#3825359";>View the orig

[JBoss-user] [Javassist user questions] - Re: Error compiling AnyNameClassOrInterface.class

2004-03-12 Thread jmarranz
Thank you. A suggestion: there are very good parser generators like ANTLR and JavaCC with very accurate Java sintax analizers, I think. http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825349#3825349";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&

[JBoss-user] [Javassist user questions] - Error compiling AnyNameClassOrInterface.class

2004-03-11 Thread jmarranz
Javassist 2.6 doesnÃÂt compile the singleton expression: Class cls = AnyNameClassOrInterface.class; inside a body source doing CtNewMethod.make Perhaps the parser doesn't recognize .class as especial static member (does Javassist thinks is a package...?) http://www.jboss.org/index.html?m