Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] postprocessing of java code

Hi all,

I would like to ask you if AspectJ is suitable for me to do the following task:

I have some already written java code (*.java) and I would like to
insert some special statements based on conditions. For example -
inserting a statement after some other statement (i.e. if a method M
of an instance of class X is called, insert statement S after that
call ...). I would like to be able to load that java code i some
format in memory (abstract syntax tree, maybe done by Aspectj anyway?)
,
modify that (i guess this is done automatically by aspectJ) , and then
serialize back to a *.java source file.

I don't want to use hacks (regular expressions, scripts, and so
forth), because it is critical that the modified code is not corrupt
later on and is guaranteed to compile at least :))

Is that easily achievable by using AspectJ ? Thank you very much in advance.

Best Regards,
Angel


Back to the top