[JBoss-user] [Javassist user questions] - Re: ldc operand is null

2005-12-15 Thread chiba
How did you modify your method with Javassist? It might be a bug. Chiba View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912850#3912850 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode

[JBoss-user] [Javassist user questions] - Re: Modifying CtClass

2005-12-10 Thread chiba
That's spec. Because the field initialization is done in a static initializer, when you remove a field, you also have to remove the initialization code from the static initializer, which is not a simple task!. So your alternative code (create another ClassPool) is a right solution. View the ori

[JBoss-user] [Javassist user questions] - Re: Bug in Annotation (Take 2) ?

2005-12-10 Thread chiba
Maybe javassist.jar has been loaded by a different class loader from your application code. Can you edit the following line to use a different class loader? in toAnnotationType() in CtClassType ClassLoader cl = Thread.currentThread().getContextClassLoader(); For example, it might have to be ch

[JBoss-user] [Javassist user questions] - Re: Bug in Annotation (Take 2) ?

2005-12-03 Thread chiba
Hi, anonymous wrote : I'd like to know the differences between "regular" java accessibility and "via javassist" accessibility. There should be no difference since Javassist code simply calls Class#forName() for accessing a class. Does pacote.Anotacao really exist under a directory included in C

[JBoss-user] [Javassist user questions] - Re: How to replace classname in local var declaration?

2005-11-30 Thread chiba
Hi, It is a sort of bug of Javassist, but it should not make any real problem since a local variable is not really typed at bytecode level. Your code should run without any problem although a decompielr may claim the type of a local variable remains the same. View the original post : http://

[JBoss-user] [Javassist user questions] - Re: Varargs Injection Unsupported ?

2005-11-27 Thread chiba
Hmm... Java 5 has not been fully supported. But I will add this to my Todo list. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3909210#3909210 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3909210 -

[JBoss-user] [Javassist user questions] - Re: Bug in Annotation (Take 2) ?

2005-11-27 Thread chiba
I think the exception was thrown because the @pacote.Anotacao interface is not accessible from your code using Javassist. Can you check your code? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3909209#3909209 Reply to the post : http://www.jboss.com/index.

[JBoss-user] [Javassist user questions] - Re: copying methods

2005-11-23 Thread chiba
I again recommend you to use ClassPool and CtClass, CtMethod, ... They provide a number of utility methods for creating a getter method etc. Otherwise, you must construct a MethodInfo by hand (you must specify a sequence Java bytecode as a body). Bytecode class would help you. View the origina

[JBoss-user] [Javassist user questions] - Re: loading a modified class directly from a ClassFile

2005-11-23 Thread chiba
I think it would be better to use ClassPool, CtClass, etc. Your problem is that you added an interface but did not change your class to be an abstract class (your class does not implement all methods from the interface.) View the original post : http://www.jboss.com/index.html?module=bb&op=viewt

[JBoss-user] [Javassist user questions] - Re: ClassFile write creates bad byte code

2005-11-23 Thread chiba
You might want to use ClassPool, which does not load a class file as well. ClassPool reads a class file but does not load it. ClassPool is a utility class for reading a class file from various resources. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3908828

[JBoss-user] [Javassist user questions] - Re: decoupled persistence layer?

2005-11-23 Thread chiba
writeFile() writes a class file under the current directory, which is sometime hard to identify if the program is running on Tomcat etc. What if giving a full path to writeFile()? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3908827#3908827 Reply to the po

[JBoss-user] [Javassist user questions] - Re: field = new CtField seems to do nothing

2005-11-23 Thread chiba
You can make a CtField by calling new CtField(), then set the modifiers to public by calling setModifiers(). View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3908698#3908698 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=

[JBoss-user] [Javassist user questions] - Re: field = new CtField seems to do nothing

2005-11-16 Thread chiba
new CtField() makes a filed visible within a package. But I think Class#getFields() returns only public fields. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3907348#3907348 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=repl

[JBoss-user] [Javassist user questions] - Re: Javassist w/ Instrumentation API

2005-11-09 Thread chiba
You can use ClassPool.makeClass(InputStream). Make a ByteArrayInputStream including your bytecode and pass it to makeClass(). View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3906202#3906202 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posti

[JBoss-user] [Javassist user questions] - Re: annotation bug?

2005-11-09 Thread chiba
Oh, you must insert the following code before calling c.toClass(): cf.setMajorVersion(49); | cf.setMinorVersion(0); I will add this info to the javadoc comment... Thanks. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3906201#3906201 Reply to the post : h

[JBoss-user] [Javassist user questions] - Re: cast errors

2005-10-29 Thread chiba
I think that problem is due to your inappropriate use of class loaders. Section 3.2 of Javassist tutorial might help you. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3904287#3904287 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&

[JBoss-user] [Javassist user questions] - Re: Create class from source in memory

2005-10-28 Thread chiba
You cannot make a CtClass from source code of a whole class declaration. However, you can first create an empty CtClass and then append to it a CtMethod created from source code of a method declaration. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3904152#39

[JBoss-user] [Javassist user questions] - Re: CtConstructor insertBefore problem

2005-10-28 Thread chiba
Please use insertBeforeBody() in CtConstructor. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3904150#3904150 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3904150

[JBoss-user] [Javassist user questions] - Re: Constructor -> Method

2005-10-28 Thread chiba
I have just implemented a convenient method toMethod() in CtConstructor. It changes a constructor to a method. super() or this() in the body of the original constructor is eliminated. Please download from CVS HEAD. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic

[JBoss-user] [Javassist user questions] - Re: intercepting array member access

2005-09-24 Thread chiba
OK, I'll put it in the TODO list. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3896888#3896888 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3896888 --- SF.Net emai

[JBoss-user] [Javassist user questions] - Re: Loading class problem

2005-09-14 Thread chiba
I guess the code above was loaded by a web app. server like JBoss AS. Please take a look at "Class search path" in Section 1 of the tutorial. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3894721#3894721 Reply to the post : http://www.jboss.com/index.html?mo

[JBoss-user] [Javassist user questions] - Re: Constructor -> Method

2005-09-14 Thread chiba
Hi, You can remove super()/this() call from a constructor if you use javassist.expr.ExprEditor. Please read the tutorial for more details. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3894718#3894718 Reply to the post : http://www.jboss.com/index.html?modu

[JBoss-user] [Javassist user questions] - Re: Loading class from relaional storage

2005-09-10 Thread chiba
Unfortunately, Javassist is not a toolkit for editing serialized data. It might be a good idea that Javassist supports that editing but currently Javassist does not. Sorry. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3893992#3893992 Reply to the post : htt

[JBoss-user] [Javassist user questions] - Re: Loading class from relaional storage

2005-09-10 Thread chiba
I don't think you can read an old serialized data in any way if you add a new field to that class. What do you mean by "inject the changes into the obsolete class"? Do you want to convert a serialized data in the database to be compatible with a new version of the class? View the original post :

[JBoss-user] [Javassist user questions] - 3.1 RC2.

2005-09-06 Thread chiba
I have released 3.1 RC2 including bug fixes reported these days. It was released mainly for an administrative reason but I hope it is also convenient for you all. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3893315#3893315 Reply to the post : http://www.jbo

[JBoss-user] [Javassist user questions] - Re: annotation bug?

2005-09-06 Thread chiba
Thank you for a bug report. I have fixed this bug. Please download the latest snapshot from CVS. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3893312#3893312 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3893312 ---

[JBoss-user] [Javassist user questions] - Re: Can we avoid

2005-09-06 Thread chiba
Are you using Eclipse for compiling a class? I have fixed this problem (I don't call it a bug :-) Can you try the latest snapshot available from CVS HEAD? Thanks! View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3893235#3893235 Reply to the post : http://www.

[JBoss-user] [Javassist user questions] - Re: How to get the value in switch case ?

2005-08-26 Thread chiba
Unfortunately, it is not simple at all. Section 5.3 of Tutorial would help you but you must be an expert of Java bytecode. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3891832#3891832 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&

[JBoss-user] [Javassist user questions] - Re: How to get the value in switch case ?

2005-08-25 Thread chiba
Javassist does not provide direct support for that. You must use the javassist.bytecode package and parse a swtich instruction by hand. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3891581#3891581 Reply to the post : http://www.jboss.org/index.html?module=bb

[JBoss-user] [Javassist user questions] - Re: instrumenting a loaded class

2005-08-24 Thread chiba
According to our experiment with HotSwap of JDK1.4 (JDK1.4 has HotSwap although it has a different name), the overheaeds is less than 5% (normally about 2%). We used SPECjvm98, which is a set of relatively small programs. So if you run a really big program, the amount of the overhead may change.

[JBoss-user] [Javassist user questions] - Re: getting a ctclass from an object

2005-08-24 Thread chiba
Hi, I don't think there is a way to obtain a class file from a running object. Do you want to change a class that has been loaded? The JVM does not allow you to do such a thing unless you use HotSwap. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3891546#389

[JBoss-user] [Javassist user questions] - Re: instrumenting a loaded class

2005-08-23 Thread chiba
For instrumenting a loaded class, you must use HotSwap provided by Sun's JVM. An upcoming new version of Javassist provides a utility class for using HotSwap. So if you are intrested, please down load the CVS HEAD and test it. View the original post : http://www.jboss.org/index.html?module=bb&op

[JBoss-user] [Javassist user questions] - Re: class is frozen

2005-08-23 Thread chiba
Hmm... defrost() should be overridden in CtClassType, a subclass of CtClass. I don't know why an exception is thrown. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3891374#3891374 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode

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

2005-08-18 Thread chiba
might be useful for others. :-) Chiba View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3890621#3890621 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3890621 --

[JBoss-user] [Javassist user questions] - Re: Register 1 in a java.lang.VerifyError

2005-08-17 Thread chiba
Sorry, it's spec. method.insertAfter(methodEnd, true); // true --> do as finally | If the second parameter to insertAfter() is true, then the local variable declared by addLocalVariable() is not vivible in the code inserted by insertAfter(). If the second parameter is false, your code should

[JBoss-user] [Javassist user questions] - Re: class is frozen

2005-08-17 Thread chiba
Hi, Please use CtClass#defrost() or CtClass#detach(). View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3890435#3890435 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3890435 --

[JBoss-user] [Javassist user questions] - Re: Error Compiling a switch

2005-08-17 Thread chiba
anonymous wrote : Now I detected anoher problem which I cannot solve. If I add in CtField public static final int TWO = 2; during runtime, the method call getConstantValue () will return a null. Now this problem has been fixed. Static final fields can be case labels. View the original post :

[JBoss-user] [Javassist user questions] - Re: Error in javassist.compiler.TypeChecker

2005-08-17 Thread chiba
I modified Javassist so that an error message is thrown instead of NullPointerException. Thanks for your suggestion. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3890430#3890430 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=

[JBoss-user] [Javassist user questions] - Re: initialization of static arrays

2005-08-15 Thread chiba
CtClass generatedClass = pool.makeClass("TestClass"); | CtField myStaticField = new CtField(pool.get(MyClass[].class.getComponentType().getName()), "myStaticField", generatedClass); | myStaticField.setModifiers(Modifier.STATIC); | generatedClass.addField(myStaticField); The third line is w

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

2005-07-21 Thread chiba
I think using a Java decompiler is a good idea. However, please don't say "Javassist has a bug!" if you see a decompiler fails to decompile the bytecode modified by Javassist. :-) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885899#3885899 Reply to the pos

[JBoss-user] [Javassist user questions] - Re: ClassCastException after javassist manipulation

2005-07-19 Thread chiba
Have you read Section 3.2 of the Javassist tutorial? It would help you understand the problem. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885590#3885590 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3885590 --

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

2005-07-19 Thread chiba
Such a tool should be great but the implementation would not be a simple task. First of all, decompiling Java bytecode to appropriate source code is not always possible (well, might be possible but difficult). Even reflecting changes on bytecode to the original source file is not easy since some

[JBoss-user] [Javassist user questions] - Re: how to avoid adding field to InnerClasses

2005-07-19 Thread chiba
Your sample code seems weird. At least, the first line: CtClass cc = pool.makeClass("ClassA"); should be: CtClass cc = pool.get("ClassA"); since makeClass() creates a new empty copy of ClassA. Can you post a real test program? If the behavior you observed is real, it is a bug. View the orig

[JBoss-user] [Javassist user questions] - Re: circular references

2005-06-30 Thread chiba
"Mutual recursive methods" in Section 4.3 of the tutorial has some hints. To create two classes that refer to each other, you must first create empty CtClasses for the two classes and then add fields and methods. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=

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

2005-06-23 Thread chiba
Thanks. According to my simple study, javac of jdk1.4 and javac of 1.5 seem to compile an inner class in a different way. I found that javac 1.5 initializes a point to the outer class before calling the super constructor. On the other hand, javac 1.4 does not do so. Thus, your sample code of In

[JBoss-user] [Javassist user questions] - Re: javassist.CannotCompileException: [source error] invali

2005-06-23 Thread chiba
Thank you for your bug report. I have fixed it. Please download the latest snapshot from the CVS HEAD. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3882507#3882507 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=388250

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

2005-06-21 Thread chiba
anonymous wrote : Note: this setting of a field before calling super is similar to how instance inner (nested) classes work, they set the field that points to their outer class before calling their own super constructor. I don't think so... Setting the field that points to the outer class should

[JBoss-user] [Javassist user questions] - Re: Accessing a parameter in a method's body

2005-06-20 Thread chiba
paramValue and returnValue are determined at runtime. Since those values are not available during compile/load time, you cannot obtain them by Javassist. Although those values can be guessed by performaing constant propagation since they are constant values, Javassist does not support it. View th

[JBoss-user] [Javassist user questions] - Re: IllegalAccessException: java/lang/ClassLoader

2005-06-20 Thread chiba
Oh, does CannotCompileException have to override printStackTrace(PrintStream)? I'll fix it. Another idea is to use JDK1.4's initCause(). Scott, can Javassist stop supporting JDK1.3? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3882159#3882159 Reply to the

[JBoss-user] [Javassist user questions] - Re: Problem with Verify Error Inconsistent stack height 0 !=

2005-06-08 Thread chiba
Can you tell us about the method parseText()? What kind of code did you generate? (please don't post 2500 lines of code... only overview is fine.) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3880784#3880784 Reply to the post : http://www.jboss.org/index.h

[JBoss-user] [Javassist user questions] - Re: how to insert an 'assert' instruction ?

2005-06-08 Thread chiba
One more thing. Calling Foo.class.desiredAssertionStatus() would take time. The bytecode generated by javac calls this method in a static initializer and the result is cached in a private static field. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3880781#3880

[JBoss-user] [Javassist user questions] - Re: how to insert an 'assert' instruction ?

2005-06-08 Thread chiba
If you don't need to turn on/off assertions, you can easily insert by doing this: insertAfter("if (expr) throw new AssertionError();") This is equivalent to: assert expr; If you want to turn on/off by the -ea option, you have to also insert the code for checking whether or not the assertion is

[JBoss-user] [Javassist user questions] - Re: why pool.insertClassPath(String) not work?

2005-06-08 Thread chiba
insertClassPath() only gives a search path for *finding* a class. It is not used to write a modified class file. Please use CtClass#writeFile(String directory). View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3880735#3880735 Reply to the post : http://www.jbos

[JBoss-user] [Javassist user questions] - Re: Error Compiling a switch

2005-06-08 Thread chiba
Yes, thank you! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3880733#3880733 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3880733 --- This SF.Net email is sponsore

[JBoss-user] [Javassist user questions] - Re: Error Compiling a switch

2005-05-31 Thread chiba
Ah... it's a known bug. I will fix it. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3879505#3879505 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3879505 --- This

[JBoss-user] [Javassist user questions] - Re: altering constructor implementation: how-to ?

2005-05-31 Thread chiba
Did you use getMethodInfo() in CtBehavior instead of getMethodInfo2() at Line 5? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3879504#3879504 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3879504

[JBoss-user] [Javassist user questions] - Re: getting all fields of a class

2005-05-31 Thread chiba
Yes, you must recursively run through the class hierarchy. Fields are never overridden. So collecting all the fields should be easy. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3879502#3879502 Reply to the post : http://www.jboss.org/index.html?module=bb&o

[JBoss-user] [Javassist user questions] - Re: Problem with java.lang.VerifyError

2005-05-23 Thread chiba
Brennan and I investigated this problem and found that the real problem was the value of the variable df declared in this statement: java.text.DateFormat df; was used before the initial value is assigned to this variable. Javac can detect this type of error is detected but the compiler of Ja

[JBoss-user] [Javassist user questions] - Re: Problem with java.lang.VerifyError

2005-05-19 Thread chiba
You can dump by calling writeFile() in CtClass. Can you put the class file on some web site or anywhere you can put? I'll check it. Note: please don't trust a decompiler too much. It cannot decompile some correct class file in principle. View the original post : http://www.jboss.org/index.htm

[JBoss-user] [Javassist user questions] - Re: help needed in creating new class from scratch

2005-05-16 Thread chiba
Line 39: runMethod.invoke( helloWorld, new Object[] { } ); is wrong. The first parameter helloWorld is a Class object. It must be an instance of HelloWorld. You must first create an instance of HelloWorld. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=38778

[JBoss-user] [Javassist user questions] - Re: NullPointerException occurs when Handler#getType() metho

2005-05-16 Thread chiba
Thank you for your bug report and pretty good analysis. It is really helpful. anonymous wrote : To avoid this problem, I propose to check null of the return value of | ConstPool#getClassInfo() (type of the exception) in the getType() method Yes, this is a correct and quick fix. However, if yo

[JBoss-user] [Javassist user questions] - Re: I've a problem When checking for null

2005-05-16 Thread chiba
I fixed this bug. Please download the CVS HEAD. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3877852#3877852 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3877852

[JBoss-user] [Javassist user questions] - Re: Javassist and Java5's enumerations

2005-05-09 Thread chiba
For another request, I'll change ClassPool.get() to accept [L...; View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3877042#3877042 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3877042 --

[JBoss-user] [Javassist user questions] - Re: How to get compiler errors

2005-04-18 Thread chiba
I agree that we need better help. However, dumping a generated class in text format is not a simple thing since *true* bytecode decompilation is hard work. By the way, have you checked the compiler-limitations page of the Javassist tutorial? View the original post : http://www.jboss.org/index.h

[JBoss-user] [Javassist user questions] - Re: Is there a way to add a static block into the class.

2005-04-13 Thread chiba
You can use CtClass#makeClassInitializer() and CtField#make(). Please look at javadoc. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3873804#3873804 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3873804 -

[JBoss-user] [Javassist user questions] - Re: Use JavAssist to obtain class annotation-list

2005-04-13 Thread chiba
Yes, you can. Please take a look at javassist.bytecode.MethodInfo and javassist.bytecode.AnnotationsAttribute. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3873800#3873800 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&

[JBoss-user] [Javassist user questions] - Re: How to get compiler errors

2005-04-13 Thread chiba
No, there is no way since Javassist uses its own small (quick) compiler. It is not supposed to be used as a regular compiler. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3873795#3873795 Reply to the post : http://www.jboss.org/index.html?module=bb&op=pos

[JBoss-user] [Javassist user questions] - Re: long method parameter must be explicitely qualified

2005-03-29 Thread chiba
Hmm.. the goal of the Javassist compiler is to help the development of a bytecode translator. It's not to be the standard compiler. But I put this fact to my todo list. Thanks! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3871902#3871902 Reply to the post

[JBoss-user] [Javassist user questions] - Re: javassist.expr.MethodCall.getClassName() question (bug?)

2005-03-24 Thread chiba
anonymous wrote : how do i navigate to get the className of the Object that implements the interface? You cannot get the actual class name of the target object. This is not the limitation of Javassist. Greeting h = new HelloWorld(); | h.speak(); Since the value of h is determined only at run

[JBoss-user] [Javassist user questions] - Re: VerifyError on javassist generated constructor

2005-03-24 Thread chiba
I see you misinterpreted the summary table of special variables. I will update it to avoid such misinterpretation. Thank you for your suggestion. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3871501#3871501 Reply to the post : http://www.jboss.org/index.ht

[JBoss-user] [Javassist user questions] - Re: inheritance question

2005-03-23 Thread chiba
It seems that multiple versions of OrgUnitType had been loaded. The error message should be interpreted as that the super class of OrgUnitImpl is a different version of OrgUnitImpl from the version that the cast operator (i.e. the class generated by Javassist) expects. If my observation is true,

[JBoss-user] [Javassist user questions] - Re: VerifyError on javassist generated constructor

2005-03-23 Thread chiba
$0 means "this". So maybe a right program is: | cons1.setBody("super((dome.interpretation.InterpretationFactory)$1, (dome.datamodel.FirstClassObject)$2);"); | Note that the arguments are $1 and $2. anonymous wrote : however if I don't then the javassist compiler complains that it canno

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

2005-03-16 Thread chiba
Really? Can you post a complete test case? Thanks! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3870411#3870411 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3870411 -

[JBoss-user] [Javassist user questions] - Re: Why is there no LocalVarAccess just like FieldAccess Exp

2005-03-06 Thread chiba
Yes, you can implement LocalVarAccess with the low-level API. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3868961#3868961 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3868961 --

[JBoss-user] [Javassist user questions] - Re: How to add a constant ?

2005-03-02 Thread chiba
See the following code: CtClass cc = ...; CtField f = CtField.make("private static final ...", cc); cc.addField(f); View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3868372#3868372 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=r

[JBoss-user] [Javassist user questions] - Re: Beginner's question !

2005-03-02 Thread chiba
At compile-time or load time? No, you cannot get the value of a variable since the value is not available before the program starts running. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3868371#3868371 Reply to the post : http://www.jboss.org/index.html?mod

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

2005-03-01 Thread chiba
Let me make sure. Javassist 3 can compile Object[].class. Chiba View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3868436#3868436 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode

[JBoss-user] [Javassist user questions] - Re: reading java 5.0 annotations

2005-02-27 Thread chiba
Yes, the default value is available from AnnotationDefault attributes. Thank you for your information. I added the support of AnnotationDefault attributes to Javassist. It is available from CVS HEAD or Branch_Javassist_3_0. Chiba View the original post : http://www.jboss.org/index.html

[JBoss-user] [Javassist user questions] - Re: How to replace this??

2005-02-25 Thread chiba
I see. Your approach is right. However, your approach might complicate a program if the search pattern is complex. For example, if you want to find both boolean b = Display.getDisplay().getCurrent() and Display d = Display.getDisplay(this); boolean b = d.getCurrent(); Then the pattern given

[JBoss-user] [Javassist user questions] - Re: Is CodeIterator.insertGap(int length) is supposed to ins

2005-02-23 Thread chiba
Well, if your post is really true, that behavior is a bug. Can you show me a test case (simple one is fine)? Thank you, View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867619#3867619 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mod

[JBoss-user] [Javassist user questions] - Re: Has somebody used javassist to perform Data Flow Analysi

2005-02-23 Thread chiba
Even the lower-level API does not directly support data flow analysis. But it is definitely possible to implement a data flow analyzer on top of it. Your contribution is welcome! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867612#3867612 Reply to the post

[JBoss-user] [Javassist user questions] - Re: How to replace this??

2005-02-23 Thread chiba
I think you want to replace cascaded method calls with another expression. But I'm wondering whether or not such replacement is used frequently enough to be included in the Javassist API. Do you think the Javassist API includes a method for replacing two-cascaded method calls, three-cascaded, ...

[JBoss-user] [Javassist user questions] - Re: Howto instrument print(a.toString()) ?!?

2005-02-23 Thread chiba
Did you assign the result of method.invoke() to $_? e.g. $_ = ($r)method.invoke($0, null); Regards, View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867598#3867598 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3867598

[JBoss-user] [Javassist user questions] - Re: Constructor modification?

2005-02-23 Thread chiba
Ah... the statements must be surrounded by {}. So setBody("{ System.out.println(...); ...println(...); }"); is correct. I agree this spec. should be changed. :-( View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867593#3867593 Reply to the post : http://www.j

[JBoss-user] [Javassist user questions] - Re: Can I get info about containing object of some methodCal

2005-02-23 Thread chiba
I hope my reply is not too late. anonymous wrote : The question is: How can I get such static information about "someObj" using javassist? The real static information of the target object is quite restricted probably more than you expect. The only information is the static type of the target ob

[JBoss-user] [Javassist user questions] - Re: reading java 5.0 annotations

2005-02-06 Thread chiba
Maybe that is because the default value is not included in each class file. (I'm not sure) public @interface Author { | | String name() default "me"; | | int age() default 999; | } Won't you try to read the annotations of the Author interfa

[JBoss-user] [Javassist user questions] - Re: Detecting and replacing operators expressions with Javas

2005-02-05 Thread chiba
I recommend using the lower-level API of Javassist, that is, javassist.bytecode.*. In fact, ExprEditor is a sort of wrapper on top of that package. I don't recommend you to use BCEL since it is slow. You should use either Javassist or ObjectWeb ASM. View the original post : http://www.jboss.or

[JBoss-user] [Javassist user questions] - Re: Get a private final static field

2005-02-05 Thread chiba
You can obtain the value of a final static field if you go down to the lower-level API of Javassist (I agree that the next release of Javassist support this function with the regular API). You must get a java.bytecode.FieldInfo object from CtField and then obtain a ConstantAttribute object from th

[JBoss-user] [Javassist user questions] - Re: reading java 5.0 annotations

2005-02-05 Thread chiba
Can you replace AnnotationsAttribute.invisibleTag with AnnotationsAttribute.visibleTag in the above test code and try again? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3865395#3865395 Reply to the post : http://www.jboss.org/index.html?module=bb&op=postin

[JBoss-user] [Javassist user questions] - Re: reading java 5.0 annotations

2005-02-01 Thread chiba
The current release 3.0 does not provide high-level API. So you must use the lower-level API, but using it is not difficult. For example, | import javassist.*; | import javassist.bytecode.*; | | CtMethod m = ... ; | MethodInfo minfo = m.getMethodInfo(); | AnnotationsAttribute attr =

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

2005-01-24 Thread chiba
I have released 3.0! Please enjoy. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3863381#3863381 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3863381 --- This SF.N

[JBoss-user] [Javassist user questions] - Re: Limitations

2005-01-24 Thread chiba
Yes, that's a perfect solution. (sorry, it's annonying...) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3863380#3863380 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3863380 --

[JBoss-user] [Javassist user questions] - Re: Limitations

2005-01-19 Thread chiba
Although $proceed does not imply this problem, newname($$); would do. I agree this is a bug, which should be fixed soon. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3862737#3862737 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting

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

2005-01-19 Thread chiba
Yes, array initialization is quite inefficient in Java. I think your technique using String is a right way. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3862740#3862740 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=38

[JBoss-user] [Javassist user questions] - Re: Adding Methodes

2005-01-17 Thread chiba
Ah, pruning is now off by default. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3862516#3862516 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3862516 --- The SF.Ne

[JBoss-user] [Javassist user questions] - Re: Limitations

2005-01-17 Thread chiba
Hi, 1) The limitation is not applied to copied bytecode. The tutorial says that the compiler does not understand synchronized. However, the upcoming release 3.0 supports a synchronized statement. So please download CVS HEAD or wait for several days. We are going to release 3.0 soon. 2) For exa

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

2005-01-13 Thread chiba
I have implemented getEnclosingClass(). The source is in CVS HEAD. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861963#3861963 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3861963 --

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

2005-01-12 Thread chiba
If I'm correct, static final fields can be initialized in a static class initializer, that is, class C { static { } : } View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861855#3861855 Reply to the post : http://www.jboss.org/index.html?module=b

[JBoss-user] [Javassist user questions] - Re: Field rename

2005-01-12 Thread chiba
If you don't define a constructor of C at all, your *compiler* define a constructor. It may also modify a constructor you defined so that it will insert some code fragment for field initialization. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861854#3861854

[JBoss-user] [Javassist user questions] - Re: How to modify this statement with Javaassist?

2005-01-12 Thread chiba
Doesn't finding a method call to getResourceAsStream() work? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861856#3861856 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3861856 ---

  1   2   3   >