Skip to main content

[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

Paul,

> 1.  It seems that I can no longer invoke intertype methods from code 
> that is not compiled by aspectj.  Is that true?
It's a known bug for 1.1.1 (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=43972) that is fixed in CVS HEAD. So you can wait for 1.2 or build the latest version from CVS HEAD.

There is also a work-around that Eric Jain devised (see http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg01271.html).

> 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.
This is "considered the correct behavior"; see bugzilla bug 46282 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=46282) and/or start a discussion about why ITD constructors are important and this should be fixed. It seems like another important use case where preserving source information would help in the weaving phase... Note that this is a problem with all ITD constructors, whether called directly or by reflection.

For a work-around, you can delegate to a constructor in the base class (e.g., create a no-arg constructor with limited visibility), e.g.,

    public SomeType.new(int z) {
        this(); // runs all the initializers
        y=z;
    }


Back to the top