I have the following 2 files:
Advised.aj:
package bugs;
public class Advised {}
aspect ITD {
public void Advised.f()
{}
}
Ref.aj:
package notbugs;
import bugs.Advised;
public class Ref {
public void g() {
new
Advised().f();
}
}
I am attempting to build Advised.aj into a jar, and refer to
it from Ref.aj, using the following ant build.xml:
<?xml version="1.0"?>
<project name="Bugs" basedir="C:\workplace\imds\Bugs"
xmlns:aj="antlib:org.aspectj">
<taskdef uri="antlib:org.aspectj" resource="org/aspectj/antlib.xml" classpath="./aspectjtools.jar"/>
<target name="clean">
<delete dir="bugs" includes="**/*.class"/>
<delete dir="notbugs" includes="**/*.class"/>
</target>
<target name="task1">
<aj:iajc srcdir="." destdir="." source="1.5" target="1.5">
<classpath location=".\aspectjrt.jar"/>
<include name="bugs/Advised.aj"/>
</aj:iajc>
</target>
<target name="task2">
<aj:iajc source="1.5" target="1.5" srcdir=".">
<classpath
location=".\aspectjrt.jar"/>
<aspectpath location="."/>
<include name="notbugs/Ref.aj"/>
</aj:iajc>
</target>
</project>
From within Eclipse, there are no build errors because this
is all one project. On the command line, however, once I execute “ant
task2”, I get the following marvelous error message which suggests that
ajc is trying to ITD f into a class it already ITDd f into before:
[aj:iajc] error at
C:\workplace\imds\Bugs\bugs\Advised.aj:5::77 inter-type declaration from
bugs.ITD conflicts with existing member: void bugs.Advised.f()
[aj:iajc] MessageHolder: (8 info) (1
error)
[aj:iajc] [error 0]: error at
C:\workplace\imds\Bugs\bugs\Advised.aj:5::77 inter-type declaration from
bugs.ITD conflicts with existing member: void bugs.Advised.f()
Let me also say that in my real use-case, the jar produced
by task1 will contain aspects that should apply to clients thereof, and as
such, that jar should indeed be in the aspectpath (not the classpath) for task2
(unless I am seriously misunderstanding something).
How to stop this duplicate attempt to ITD?
Josh