4 Replies Latest reply on Mar 31, 2005 7:10 AM by carsten r

    Howto instrument print(a.toString()) ?!?

    carsten r Newbie

      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