[JBoss-user] [Javassist user questions] - Re: Generating source code in adition to class files

2005-07-21 Thread hlovatt
I will keep that in mind, that a decompiler might struggle with a manipulated bytecode. Thanks for the advice. For your interest Dennis Sosnoski, who as written about Javassist - I think you reference his articles, is talking about writting a library that can manipulate bytecodes and generate s

[JBoss-user] [Javassist user questions] - Re: Generating source code in adition to class files

2005-07-20 Thread hlovatt
@genman, Thanks for the tip - I will give jode a try View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885692#3885692 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3885692 ---

[JBoss-user] [Javassist user questions] - Generating source code in adition to class files

2005-07-14 Thread hlovatt
Hi, Have you ever thought of adding the ability for Javassist to spit out source as well as class files? In particular to have in CtClass methods in addition to toClass and writeFile that output source. EG toSource and writeSource. I am looking at using the annotation processing tool (apt) and

[JBoss-user] [Javassist user questions] - Re: Setting a field in a constructor before super is called

2005-06-23 Thread hlovatt
My Sun 1.4.2 javac initializes the pointer first. Also see the end of the first sub-section in the how it works section of the 1997 specification: http://www.flex-compiler.csail.mit.edu/jdk/guide/innerclasses/spec/innerclasses.doc2.html This implies that it is erronous not to initialize this$0 b

[JBoss-user] [Javassist user questions] - Re: Setting a field in a constructor before super is called

2005-06-22 Thread hlovatt
You can by the way use Javassist to do what I want, but it is a bit of a pain! You can write a program that modifies Derived above so that it calls super after initializing the field: | package examples.vmts.initializationorder.chibaexample; | | | import javassist.*; | import javassi

[JBoss-user] [Javassist user questions] - Re: Setting a field in a constructor before super is called

2005-06-21 Thread hlovatt
I am pretty certain I am right, inner classes initialize their pointer to the outer field before calling their own super. EG: | abstract class Base { | Base() { | System.out.println( getField() ); | } | | abstract int getField(); | } | The constructor calls t

[JBoss-user] [Javassist user questions] - Setting a field in a constructor before super is called

2005-06-20 Thread hlovatt
I want to set a field in a constructor before super is called so that the super constructor can use the field, e.g.: | abstract class Base { | Base() { System.out.println( getField() ); } | abstract int getField(); | } | | class Derived extends Base { | int field; |

[JBoss-user] [Javassist user questions] - get finds classes it shouldn't

2005-03-31 Thread hlovatt
If a class is compiled that does not have a package statement but is mistakenly loaded in Javassist as though it did have a package statement then Javassist will not detect this error and find the class and some methods will give incorrect results but not thow an exception whilst others will thr

[JBoss-user] [Javassist user questions] - Re: Array Class Literals

2005-03-30 Thread hlovatt
First two appologies: I don't seem to be able to watch this thread so I missed your post and secondly my test class is a little long :( . Take a look at lines 75 to 90 which demonstrate the problem I am having with array class literals and also with testing for null on primitive arrays (see sepe

[JBoss-user] [Javassist user questions] - Re: Array Class Literals

2005-03-13 Thread hlovatt
3 couldn't when I tried the above example. Howard. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869965#3869965 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869965 -

[JBoss-user] [Javassist user questions] - Re: Primitive arrays compared to null

2005-02-27 Thread hlovatt
Ignore - I forgot to watch the topic :) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3868136#3868136 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3868136 --- SF em

[JBoss-user] [Javassist user questions] - Re: Array Class Literals

2005-02-27 Thread hlovatt
Ignore - I forgot to watch the topic :) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3868135#3868135 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3868135 --- SF em

[JBoss-user] [Javassist user questions] - Primitive arrays compared to null

2005-02-27 Thread hlovatt
Hi, The following code fails in the Javassist compiler when $2 is a primitive array: if ( $2 != null ) | return $2.length; Instead I have to use: if ( System.identityHashCode( $2 ) != 0 ) | return $2.length; Are there plans to add support for comparing primitive arrays to n

[JBoss-user] [Javassist user questions] - Array Class Literals

2005-02-27 Thread hlovatt
Hi, The following code fails in the Javassist compiler: if ( $3 instanceof Object[].class ) | return $3.length; Instead I have to use: Class array = java.lang.reflect.Array.newInstance( Object.class, 0 ).getClass(); | if ( array.isInstance( $3 ) ) | return $3.length; Are

[JBoss-user] [Javassist user questions] - Re: Bug in getDeclaringClass in 3.0RC1

2005-01-23 Thread hlovatt
"chiba" wrote : I have implemented getEnclosingClass(). | The source is in CVS HEAD. Thanks - I look forward to the next release Keep up the good work View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3863341#3863341 Reply to the post : http://www.jboss.org/i

[JBoss-user] [Javassist user questions] - Re: Bug in getDeclaringClass in 3.0RC1

2005-01-06 Thread hlovatt
I think I can answer my own question :) In java.lang.Class the method getDeclaringClass returns null for an anonymous class because the Java Language Specification doesn't list anonymous classes as members of a class (but strangely does list named classes as members). I suspect therefore that C

[JBoss-user] [Javassist user questions] - Bug in getDeclaringClass in 3.0RC1

2004-12-30 Thread hlovatt
There is a bug in the getDeclaringClass method of CtClass when you try and get the declaring class of an anonymous inner class it throws FileNotFoundException. EG: package examples.javassisttests.declaringclasses; import javassist.*; public class Test { public static void main( final String[