Bug 44590 - Missing incomplete class error for declare parents construct
Summary: Missing incomplete class error for declare parents construct
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 1.2   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-09 14:14 EDT by Morten Christensen CLA
Modified: 2004-03-19 09:52 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.