Bug 507872 - [Errors and Warnings] @Override in anonymous interface implementation
Summary: [Errors and Warnings] @Override in anonymous interface implementation
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-21 06:39 EST by Marvin Fröhlich CLA
Modified: 2016-11-21 09:30 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marvin Fröhlich CLA 2016-11-21 06:39:29 EST
There should be another exception to the "Missing @Override annotation" rule for anonymous implementations like this.

##################################################
btn.addActionListener( new ActionListener()
{
    public void actionPerformed( ActionEvent e )
    {
    }
} );
##################################################

If I set this rule to 'Warning' (and also include interfaces') the code above would produce a warning. Anonymous inline implementations get pretty bloated with the @Override line(s).

I know, in the above case I could use lambda. But I can't, if there are two methods to be implemented.