[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Intertype Questions after porting to 1.1.1
|
Hi Paul -
Thanks for upgrading!
In reverse order:
- Use the iajc task, not Ajc10, if you can.
(though results *should* be the same)
- Please do submit a bug for the reflective-invocation of
the constructor defined by the aspect (presumably publicly);
it will at least result in a doc clarification. Try it
first with the latest compiler.
- Is Reservation an interface? You might try using the
latest compiler, since there have been some fixes to the
implementation of ITD on interfaces since 1.1.1.
Most likely you'll get an error for this line:
> public int Reservation.getTicketCount();
If you add "abstract", then the method will be added
to the interface contract, and clients will be able to
invoke getTicketCount() using a reference of the interface type
even if they are compiled later using the class ajc produced.
As you may know, implementation of ITD on interfaces is limited
to the types in the control of the implementation because
they are implemented on the top-level classes.
Hope this helps!
Wes
Paul Christmann wrote:
I finally ported our app from 1.0.6 to 1.1.1, and encountered two
(perhaps 3) issues with intertype declarations (which I still call
Introduced members, but I'm trying to use the new lingo...):
1. It seems that I can no longer invoke intertype methods from code
that is not compiled by aspectj. Is that true?
We have one jar that is built using aspectj, but we then use that jar in
other applications that are built with javac. In 1.0.6, it was possible
to directly call "introduced" methods from the straight javac code, but
that appears not to be possible now - even though the aspectj compiled
class files appear to show the introduced methods (using javap).
For example, here are two classes that I compile with ajc:
public class Reservation {
// stuff omitted for brevity
}
public aspect ReservationAspect {
private int ticketCount = 0;
public int Reservation.getTicketCount();
}
Then, here is a test case that I compile with javac including the
classes compiled above on the classpath.
public class ReservationTest extends junit.framework.TestCase {
public void testReservationTicketCount () {
Reservation res = new Reservation();
assertEquals(0, res.getTicketCount());
}
}
The test case above will not compile - javac reports that it "cannot
resolve symbol: method getTicketCount()". This worked fine with 1.0.6.
2. Introduced constructors seem to not invoke initializers on the class
when invoked via reflection. Is this intended behavior? I've only
experimented with default constructors, so I don't know if it is more
general than that. I have reproduced this in a small test case, and
will submit if this represents a bug.
So I had to move introduced constructors onto the class being constructed.
------------------
I have a build file and small set of source that illustrates both of
these issues, and will post to bugzilla if these describe unexpected
behavior. One thing that seems odd: I only compile via the ant tasks.
If I use the <ajc> task provided with 1.1.1 (i.e., the Ajc10 Task), then
both of these problems appear. If I use the <ajc> task with 1.0.6, then
neither of them appear.
Thanks for any insight or pointers anyone can provide.
------
PC
Paul Christmann
Prior Artisans, LLC
mailto:paul@xxxxxxxxxxxxxxxxx
504-587-9072
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users