Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Is AspectJ capable of modifying source code?

Hi all,

I am very new to AspectJ and I would like to know whether AspectJ can
modify existing source code ? Is there some post-processing way of
injecting (the results of) invoking aspects in the source code , in
design/build  time?

For instance, I would like to insert some java statement whenever some
method X of class Y is called. I would like to do that with an aspect,
but I would like AspectJ to actually modify the source code not to
"invoke" the stuff at runtime (or inject it at classload time).

The easiest alternative to me is, of course, to use regular
expressions, parsing , and similar "hacks", but I would prefer a
cleaner solution that is semantic-aware and always guaranteed to
insert statements at the correct location.

Thank you very much for your feedback.

Best Regards,
Angel


Back to the top