Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Intertype Questions after porting to 1.1.1

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




Back to the top