| Summary: | Ajc refuses @Override on a "normal" implementation in presence of ITD one | ||
|---|---|---|---|
| Product: | [Tools] AspectJ | Reporter: | Roman Shevchenko <trespasserw> |
| Component: | Compiler | Assignee: | aspectj inbox <aspectj-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | aclement, michlz |
| Version: | 1.6.12 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
It isn't totally clear that this is a bug. The m() you have ITD'd onto I is the 'default implementation' of m() - it doesn't really exist on I as a real method. From that point of view the @Override variant of m() is not actually overriding an implementation from the supertype. I can see what you are saying though, it almost feels like it is an override. I mean that an introduction of the inter-typed m() breaks a plain Java inheritance flow. In the given example I would like to think of Implement.m() overriding it's declaration in the interface - not the added method. Eclipse works with the following code for a long time now:
public interface I {
void m();
}
public class Impl implements I {
@Override
public void m() { }
}
The code completion "Add unimplemented methods" (in absence of method m() in Impl) even includes the method with annotation "@Override".
Therefore, I assume that "@Override" is expected right there and the initial report is showing a bug.
|
In a following code: public aspect ATest { public static interface I { void m(); void g(); } public void I.m() { } public static class Impl implements I { @Override public void m() { } // error: The method m() of type ATest.Impl must override or implement a supertype method @Override public void g() { } // ok } }