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 208009 - The ide should suggest implementing a given interface if 'this' is used as arg. to a method that require the interface.
Summary: The ide should suggest implementing a given interface if 'this' is used as ar...
Alias: None
Product: editor
Classification: Unclassified
Component: Hints & Annotations (show other bugs)
Version: -S1S-
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milutin Kristofic
Depends on:
Reported: 2012-02-02 09:11 UTC by akobberup
Modified: 2016-07-07 07:46 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description akobberup 2012-02-02 09:11:51 UTC
If i in a method in a new java class write the folowing code:

javax.swing.JButton cButton = new javax.swing.JButton();
cButton.addActionListener( this );

I will naturally get an error, like this:

method addActionListener in class javax.swing.AbstractButton cannot be applied to given types;
  required: java.awt.event.ActionListener
  found: <classname>
  reason: actual argument <classname> cannot be converted to java.awt.event.ActionListener by method invocation conversion

I would be nice to have a hint like 'Implement Interface' that will make my class implement the given interface - or extend the given arg. class if that is the case.
Comment 1 Martin Balin 2016-07-07 07:29:09 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 2 akobberup 2016-07-07 07:46:41 UTC
I still find that this would make sense in nb 8.2