[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] tomcat jsp integration part 2


I spent some more time today working on getting Tomcat to compile aspects into JSPs. Painful stuff, but I made progress:

1) When I used org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter as the compiler, no output appears.
2) I discovered that the AspectJ compiler adapter handles the case of not having a destination directory defined inconsistently from the JavaC task: instead of putting output wherever the source is located, it puts it rooted in the current working directory.
3) This caused the Tomcat JSP compilation to break

However, on the good news front: 
4) I have made a modified version of the Ajc ant task and compiler adapter that allow AspectJ compiles to work, and pass extra arguments in using an environment variable. It basically adds support for null destdir's.

Using this, I was able to get JSPs to compile using AspectJ. I'm now able to weave aspects using an aspectpath, but am hitting a VerifyError on the woven classes:

java.lang.VerifyError: (class: ajee/ui/security/LogJsps, method: aspectOf signature: ()Lajee/ui/security/LogJsps;) Stack size too large

Any idea what might be happening here?

5) I tried to use a static ThreadLocal to let one set the info locally, but this isn't working (it's probably a classloader issue); this will be important so you can set different compilation options for different Web apps.

As an aside, it's amazingly hard to find out what's going on with the Tomcat ant compiles. It builds string buffers of output that never get logged anywhere. You need to hack their code or use a debugger to read it...

I've attached the sources what I've got so far, though it's not fully tested and ready to submit. I can submit a bug in bugzilla to track all this if you like...

I'm planning to submit a patch for this once I get everything figured out. Is it obvious how to regression test it?


Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895

Attachment: AjcTaskExp.java
Description: application/java

Attachment: Ajc11CompilerAdapterWithArgs.java
Description: application/java