1 Reply Latest reply on Jan 10, 2007 11:14 PM by Eliot Moss

    insertBefore and replacing support for throw.

    Alfredo Cadiz Newbie

      Hi,

      I've been looking the source code of javassist in order to add insertBefore and replacing support for the throw operation.
      I've found that throw is considered a statement but I can't find a way to use it like a CtMethod to provide the needed features.

      I would like to know where I should look and modify to successfully create an Object CtThrow that could allow to make instrospection over this operation.

      Cheers,
      Alfredo

        • 1. Re: insertBefore and replacing support for throw.
          Eliot Moss Newbie

          I think what you'd need is an ExprEditor for athrow
          bytecodes. If done at that level, the exception object
          will already have been constructed, but not yet thrown.
          Presumably you could modify or replace it, or do
          something else. But you'd need either to return from
          the method or throw something that it either handles
          locally or that is legal to throw from the method.
          Easiest and safest might be to restrict it either to return
          (a type-safe value) or throw an object of the original
          exception class.