Bug 44590

Summary: Missing incomplete class error for declare parents construct
Product: [Tools] AspectJ Reporter: Morten Christensen <mortench2004>
Component: CompilerAssignee: Jim Hugunin <jim-aj>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 1.1.1   
Target Milestone: 1.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Morten Christensen CLA 2003-10-09 14:14:07 EDT
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).
Comment 1 Adrian Colyer CLA 2003-12-08 10:09:43 EST
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.
Comment 2 Jim Hugunin CLA 2004-01-14 11:14:32 EST
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.
Comment 3 Adrian Colyer CLA 2004-03-19 09:52:29 EST
updating target flag to indicate inclusion in 1.2 release.