Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Static Analysis, BCEL and aspectj

Hi all,

I have a few novice questions about aspectj.

1) Why can't aspectj be used to perform *some* forms of static
analysis? For example, for a given source code, I need to find if the
code has any calls to java.io.ObjectInputStream.readObject and the
type of object being read if any calls exist. I can use a static
analysis tool like PMD to find this out, but writing a tree walker is
extra work when aspectj knows how to do it. Why can I not write
something like a compile_time_pointcut and compile_time_advice to
specify this? Since aspectj already knows how to match patterns it can
give me the points I am interested in during compile time and run the
compile_time_advice. I understand that this approach is not as
powerful as one would like it to be, but this seems like a better
approach then the existing tools. I am not aware if any of the static
analysis tools can match patterns using a pointcut like syntax, so
this seemed like a useful addition.

2) Why is there no support for join points at a line level? For
example, I want to write an advice before or after the true condition
block of the if clause. Is there any fundamental reason why this is
not possible  in aspectj? IIRC I can do this using BCEL or other byte
code engineering libraries. But, I heard that using 2 instrumentation
tools on the same code is a bad idea (ex: aspectj and BCEL) since
either of them may not understand the instrumentation made by the
other. What do people do when they have to instrument code at a low
level and still have to use aspectj. What libraries should  I use, if
I want to do some bytecode level engineering and still use aspectj?

TIA,
-S-


Back to the top