Bug 357952 - Ajc refuses @Override on a "normal" implementation in presence of ITD one
Summary: Ajc refuses @Override on a "normal" implementation in presence of ITD one
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.12   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-16 10:55 EDT by Roman Shevchenko CLA
Modified: 2013-07-24 07:01 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Shevchenko CLA 2011-09-16 10:55:15 EDT
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
    }
}
Comment 1 Andrew Clement CLA 2011-09-16 16:09:44 EDT
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.
Comment 2 Roman Shevchenko CLA 2011-09-25 03:35:04 EDT
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.
Comment 3 Kirsten M. Z. CLA 2013-07-24 07:01:18 EDT
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.