Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] limitation: inter-type declaration targets

Wes Isberg wrote:
I'd like to confirm what should be required when
declaring methods on library interfaces.  In particular,
it seems to be required that all implementions of the
interface be woven as well.

To be a little more precise: If you introduce non-static fields or non-abstract methods on an interface from an aspect, then all of the top-most implementors* of that interface must be woven by that same aspect. In the latest interface-related bug-fix, I added an error message to the compiler if you don't do this when using ajc.

(*) A class C is a top-most implementor of an interface I if C implements I and the superclass of C does not implement I.

The problem is that it would be nice if you do declare
public members on an interface in an aspect, you'd like
to be able to compile against that library using javac:

This would be nice, but I believe it is technically impossible. Java has no support for non-abstract methods or non-static fields on interfaces, and the only way I know to implement this correctly is by modifying the top-most implementors of the interface.

In the future, we could extend ajc to support this transparently when these interfaces are placed on the classpath instead of the aspectpath. This would probably be a nice improvement for 1.2.

-Jim




Back to the top