Community
Participate
Working Groups
One of the killer features of AspectJ is that it allows you to add a interface to an existing class/interface using the "declare parents" construct. Subsequently, one use inter-type member declarations to make sure the existing classes affected by the new interface decleration implements the new methods. However, AspectJ does not actually check that everything is consisting and valid. This can be problematic as it is easy to "forget" or mistype a inter- typse decleration so that the interface specified in "declare parents" is not implemented correctly (something that may happen over time because of changes). In case of inconsistencies, AspectJ should give an error (or at least a warning) that the declared parent interface is not fully implemented and usage of the class may result in runtime errors. P.S. At best this should normally be an error but something that can be downgraded to a warning with a compiler flag (since there are a few (very few) cases were it is practical or usefull not to regard this as an error).
Could you add a small test case to this bug report that reproduces the bug please? I tested with the following: class ITDTest {} aspect AddInterface { interface Foo { void bar(); } declare parents : ITDTest implements Foo; } and got the correct error message: ITDTest.aj:1 Class must implement the inherited abstract method AddInterface. Foo.bar() class ITDTest {} ^^^^^^^ Note that this is very different to: class ITDTest {} aspect AddInterface { interface Foo { } void Foo.bar() {} declare parents : ITDTest implements Foo; } which both defines the bar() method in Foo, and provides a default implementation of it.
We believe this is now fixed in the current tree. If you don't find this is true, please repoen with a self-contained test case showing the problem.
updating target flag to indicate inclusion in 1.2 release.