I’ve run into a case where ajc breaks if you put
something on the aspectpath when weaving a dependant inpath jar, but it works if
you put them both on the inpath. I think this is a bug in AspectJ: it should be
willing to weave types that something on the aspectpath depend on. Am I right?
On a project we’re working on we have a monitoring module
that includes aspects with a compile-time dependency on an API module (on an
interface). The API module needs to be woven by the monitoring module. Now we’ve
been able to weave this way for a while having the monitoring jar on the aspectpath
and the API jar on an inpath. This has worked and produced correct output for
us.
However, we were testing a new weaving approach for our system
regression tests that weaves all modules in the project on the inpath (it
applies enforcement aspects). We set this up having monitoring on the
aspectpath and the rest of the project modules on the inpath. Unfortunately, we
had cantFindType warnings for types that the monitoring references from the API
module. More disturbingly, when we made those an Xlint warning and ran the code
it produced a verify error. If we move the monitoring module to the inpath, everything
works just fine.
This is useful in a case where you want to weave separately
(i.e., we typically weave subsets of modules in the project, so we need to put
monitoring on an aspectpath rather than putting it in the inpath, which would
create duplicate copies of monitoring classes).
Ron