This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253669 - Use anonymous inner class does not add @Override annotation to the method
Summary: Use anonymous inner class does not add @Override annotation to the method
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-23 08:39 UTC by Jachym_Vojtek
Modified: 2015-07-23 08:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jachym_Vojtek 2015-07-23 08:39:19 UTC
import java.awt.event.ActionEvent;
import javax.swing.JButton;

public class C {

    JButton btn;

    void init() {
        btn.addActionListener((ActionEvent e) -> {
            System.out.println("Btn clicked!");
        });
    }
}

Applying "Use anonymous inner class" converts code to:

    void init() {
        btn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                System.out.println("Btn clicked!");
            }
        });
    }


I would expect that the method 'actionPerformed' should be annotated with @Override annotation, other IDEs add this annotation.