[JBoss-user] [Javassist user questions] - Re: Why is there no LocalVarAccess just like FieldAccess Exp
Thank you Mr. Chiba for your response. I have another question which is almost the same as my previous question. Why is there no Expr class for logical-expressions, arithmetic-expressions, and things like them? I want to analyse a code-line (as a Abstract Syntax Tree) to see what kind expressions a given code-line contains. I can now know whether an expression is a method-call, new, cast, instanceOf, fieldAccess, but not if it's a logical-expression, using the high-level API. I think, I can use the low-level API to realise that kind of analysis. Am I right? Is it valuable to make high-level API for that kind expressions? I appriciate very much your valuable responses. Thanks View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869399#3869399 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869399 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Why is there no LocalVarAccess just like FieldAccess Expr?
Hi, I use javassist Expr classes (for example FieldAccess) to construct a model of the running java class. It would be very fine if there was a javassist LocalVarAccess (just like FieldAccess) in order to get information about the local-variables of a method (and hence about the behavior of the method). Is this absence intentional? Is it feasible that I can make it using the javassist Expr class or should you I use the javassist low level API? Thanks in advance With kindly regards Reza View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3868818#3868818 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3868818 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Has somebody used javassist to perform Data Flow Analysis?
Hello there, I'm looking for pice of code which uses javassist to perform Data Flow Analysis on Java Byte Code. I want to use that for an academic project relating self-management (self-healing). If nobody has such a code I want to write it by myself. But the question is whether it is feasible to use javassist to write a Data Flow Analysis on java byte-code? Thanks in advance View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867452#3867452 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3867452 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Can I get info about containing object of some methodCal
Hi, Thank you for your response. But it doesn't solve my problem. As you can see from my previous mailing, I have already used ExprEditor to get information about "someMethod" in the following method-call expression: .. someObj.someMethod .. But I need information about "someObj". I need just static information like the name of "someObj", it type (class), ... . The question is: How can I get such static information about "someObj" using javassist? Thanks. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3866891#3866891 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3866891 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Can I get info about containing object of some methodCal
You are absolutely right. I want actually static information about "someObj", like object-type, ... . Would you please tell me how I can get this information? Thanks View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3865685#3865685 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3865685 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Can javassist make a CtClass from a serialized object?
I'm sorry if this question has already been asked. I need at runtime to serialize a running object (I have to keep the state of the object) and make a CtClass from the serialized object and make some changes to it and load the new modified class. Is this possible with javassist? Thanks in advance View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3859737#3859737 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3859737 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Can I get info about containing object of some methodCall?
Hello, Suppose I have the following MethodCall expr: .. someObj.someMethod .. If I use: curMethod.instrument(new ExprEditor() public void edit(MethodCall m) throws CannotCompileException { ... then I can get information about the methodCall "someMethod". For analysis purposes I will also get information about "someObj", that the method is a method of the object "someObj". Is it possible to get such information using ExprEditor? Or I should get in another way and how? Thanks in advance View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3859062#3859062 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3859062 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: addCatch doesn't work
Thank you very, chiba for your response. I used {return;} and it works. But if there are methods with non-void return types then {return;} is not enough. Therefore I used (within my addCatch) {Object result; return ($r)result;}. But I get the following javassist compiler error: == javassist.CannotCompileException: [source error] no such class: $r at javassist.CtBehavior.addCatch(CtBehavior.java:722) at javassist.CtBehavior.addCatch(CtBehavior.java:670) == It seems that the javassist compiler doesn't recognize $r. Is it not allowed to use $r in the addCatch? Or do I do something wrong? Thanks in advance View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3858187#3858187 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3858187 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - addCatch doesn't work
I used addCatch as follows: = for (int i = 0; i < allMethods.length; i++) { CtMethod method = allMethods; if (method.getName().startsWith("set")) { StringBuffer insCode = new StringBuffer(); insCode.append('{'); //insCode.append("System.out.println($e);"); //insCode.append("System.out.println(\"\");"); //insCode.append("java.lang.StackTraceElement[] ste = $e.getStackTrace();"); //insCode.append("System.out.println(ste[0].getLineNumber());"); //insCode.append("System.out.println($e.getMessage());"); //insCode.append("System.out.println(\"\");"); insCode.append('}'); method.addCatch(insCode.toString(), expClass); } } == When I look at the decompiled (by JAD) class-file, I see the instrumentation is done perfectly. But If I want to run the instrumented class-file I get the following error-msg from JVM: java.lang.VerifyError: (class: nl/vu/cs/iids/MyPoint, method: setRectangular signature: (DD)V) Falling off the end of the code == MyPoint is an example class with a number of set-methods. (It is the example class which is shiped by AspectJ). I have tried also with the javassist 2.6. But I got the same problem. Thanks View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3858049#3858049 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3858049 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: javassist-3.0RC1: replace("{}") doesn't work.
I'm sorry. I don't understand your answer. I try to say that replace("{}") doesn't work with javassist-3.0RC1. Which release should I use? Thanks. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3857992#3857992 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3857992 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - javassist-3.0RC1: replace(
Hello, I have tried the following code, based on the tutorial: = public class Test { public static void main(String[] args) throws Exception { ClassPool pool = ClassPool.getDefault(); pool.insertClassPath("some-path"); CtClass cc = pool.get("nl.vu.cs.iids.MyPoint"); CtMethod sMethod = cc.getDeclaredMethod("setTest1"); sMethod.instrument(new ExprEditor() { public void edit(MethodCall m) throws CannotCompileException { System.out.println("> " + m.getMethodName() + " line: " + m.getLineNumber()); m.replace("{}"); //m.replace("{ $1 = 0; newX = $1 + 50.2; $_ = $proceed($$); System.out.println(\"This is added line.\"); }"); } }); } } === when I run the program I get the following error: > toString line: 28 javassist.CannotCompileException: the resulting value is not stored in $_ at javassist.expr.Expr.checkResultValue(Expr.java:170) at javassist.expr.MethodCall.replace(MethodCall.java:209) at nl.vu.cs.iids.Test$1.edit(Test.java:32) at javassist.expr.ExprEditor.doit(ExprEditor.java:118) at javassist.CtBehavior.instrument(CtBehavior.java:362) at nl.vu.cs.iids.Test.main(Test.java:29) Exception in thread "main" === As I know, when we want to remove a method-call expression we can just give the "{}" source text to the replace method. Am I right? Thanks in advance Reza View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3857302#3857302 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3857302 --- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user