[JBoss-user] [Javassist user questions] - Re: Howto instrument print(a.toString()) ?!?
hi ... i still tried to solve what i am doing wrong, but i just dont get a clue :( Really noone knows a hint how to do that?!? regards View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3872151#3872151 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3872151 --- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/info/Sentarus/hamr30 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Howto instrument print(a.toString()) ?!?
Hmm ... so there is no solution to this problem? Or am i doing sth wrong ?!? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3869169#3869169 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3869169 --- 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=6595alloc_id=14396op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Howto instrument print(a.toString()) ?!?
Yes ... thats the way i try to do it. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3867704#3867704 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3867704 --- 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=6595alloc_id=14396op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Copy-Method
Ok ... wrong question or better the Exception is caused by sth else than then a wrong copy operation. I am also redirecting internal method calls and there somehow is an error. So best remove this post ... thanx View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3867185#3867185 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3867185 --- 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=6595alloc_id=14396op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Howto instrument print(a.toString()) ?!?
Hi, it seems i have discovered my problem now correctly, not as mentioned in my last thread that the copy operation of methods seemed to fail. No ... the problem lies somewhere else and i have figured out which construct it caused. If i have sth like this within a methodbody: | | new Exception(b.getValue()); | ... | and i want to replace the call of b.getValue() by sth like this | if(){ |// get method with java reflection mechanism | }else{ |// call old method | } | But at the moment i have also no clue why this is the case. Does Javassist have trouble in translating sth like this ?!? | java.lang.reflect.Method method = $0.getClass().getMethod(say, null); | method.invoke($0, null); | Sincerely Sirrurg View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3867195#3867195 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3867195 --- 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=6595alloc_id=14396op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Copy-Method
Hi, i have discovered a strange behaviour. I tried to instrument methods of a class and somehow i get after the instrumentation, which seemed to work an Error. When i try to use the changed class in its old enviroment, i get an exception/error by the verify, which says, that the given stack size of the method is not correct! Could it be, that javassist has under special condition problem to copy Methods? I am using the simple CtNewMethod mechanism to get a duplicate of a method an to rename the old method. sincerely sirrurg View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3867159#3867159 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3867159 --- 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=6595alloc_id=14396op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Copy-Method
Hmm ... i should be more precise with this question. Here is the code fragment of the class i am instrumenting. | | public void putNewEntry(Object key, SimpleEntry entry) | throws AlreadyContainedException{ | | } | | This method simply inserts an new key-value pair into an Hashtable of my class. If the key-value pair is already in the hashtable i throw an exception. Its probably important that the second parameter is an interface. This interface also inherits from serializable, so that this types of objects can be stored. Now i am simply copying this method with the help of Javassist and rename it like this: | . | public void copyMethod(CtClass clazz, CtMethod method){ | String mname = method.getName(); | String nname = mname + ComponentInstrumentor.mAPPENDIX; | method.setName(nname); | CtMethod mnew = CtNewMethod.copy(method, mname, clazz, null); | clazz.addMethod(mnew); | } | | Anyone a clue why i am getting such an error: | java.lang.VerifyError: class ... copyMethod signature: (Ljava/lang/Object;LsimpleDB/SimpleEntry;)V (inconsitent stack height 0 != 2 | View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3867163#3867163 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3867163 --- 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=6595alloc_id=14396op=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
Hmmm ... and sth like this doesnt solve ur problem?!? | | public void edit(MethodCall m) { | |CtClass c = m.getMethod().getClass(); |c.getName(); | | } View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3866965#3866965 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3866965 --- 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=6595alloc_id=14396op=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, simply have a look at the API oder better at the Tutorial too, there i guess u can find everything u want. The process of getting this info should be sth like this: 1) load class 2) get desired method 3) use your XYZExprEditor, which should inherit from from javassist.expr.ExprEditor 4) call CtMethod.instrument(XYZExprEditor) (of course in this case CtMethod should be an instance the method u want to look at) 5) within your XYZExprEditor, there is a Method edit(MethodCall ...) which identifies an call to a method within a method body. With this class MethodCall u can get the desired infos i guess. Hopefully this info helped u a bit and i didnt make a mistake Bye View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3866600#3866600 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3866600 --- 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=6595alloc_id=14396op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Limitations
So to avoid this problem, i could work around by producing sth like | ... | newname((Type1)$1, (Type2)$2, ...) | ... | Or wouldnt this help anyway?!? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3862808#3862808 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3862808 --- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag--drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Adding Methodes
OK ... thx, good to know ;) View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3862533#3862533 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3862533 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Limitations
1) Ok ... in this case i can surely wait, as i m just going to copy methods and not trying to create new ones. 2) Thx for the example. How is the behaviour if i m performing wrapping like in Java programming dynamics, Part 4: Class transformation with Javassist by Dennis M. Sosnoski, IBM developerWorks, September 16, 2003. So just by copy methods, rename one and add a call like: | | newname($$); | | Do i also have this drawbacks if i m handling it this way? Sincerely Sirrurg P.S.: I hope this question dont become to annoying to you[/url] View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3862535#3862535 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3862535 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Limitations
Hi, i have a question about the limitations mentioned in the tutorial on the javassist webpage. 1) as javassist doesnt support synchronized statments, does this mean that this could cause also problems when im copying a method that is synchronized or contains such a block? 2) to the statement: Compiler may confuse if methods defined in a class have the same name but take different parameter lists Does this mean the generated byte code may be unsattled? Or will be no code generated in this case? sincerely sirrurg View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3862366#3862366 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3862366 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Adding Methodes
Hi, i ll tried this 2 step method out and it works. And by loading all classes at the beginning of the processing, i dont have to use stopPruning. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3862300#3862300 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3862300 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Adding Methodes
OK... thx very much, i ll try this out. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3861881#3861881 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3861881 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Re: Adding Methodes
ok ... thx! So if i understand this correctly, to add the cross-call to B.dosthmore(), this class must also already contain a method called dosthmore$impl(), before i can add the new method-body to A.dosth$impl(). As consequence i must first add all new methods as abstract to all classes which should be changed and then in an 2nd step add the implementation of this methodes, like in the following code? | ... | foreach(CtClass cls in classes){ |cls.stopPruning(true); |addAbstractMethodes(cls); |cls.writeFile(); | } | foreach(CtClass cls in classes){ |addImplOfMethodes(cls); |// here probably cls.stopPruning(false); |cls.writeFile(); | } | // everythings done hopefully | View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3861805#3861805 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3861805 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Javassist user questions] - Adding Methodes
Hi everyone! I have a question about bytecode manipulation with Javassist. Is it possible to modify more than one class a time and compile them together?!? I think of doing sth like this: | class A{ | void dosth(){ | ... | B.dosthmore(); | | } | } | class B{ | void dosthmore(){...} | } | And i want to change it in sth like this .. | class A{ | void dosth$impl(){ | ... | B.dosthmore$impl(); | ... | } | void dosth(){ | ... | dosth$impl(); | | } | } | class B{ | void dosthmore$impl(){...} | void dosthmore(){...} | } | As i saw in the tutorial it is easy to modify one class a time, is this also true for more than 1?!? Or do i have to split this up into 2 Loops ? Sincerely Sirrurg View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3861627#3861627 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3861627 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user