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 47491 - Override/Implement method doesn't work for anonymous inner classes
Summary: Override/Implement method doesn't work for anonymous inner classes
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Windows 3.1/NT
: P3 blocker (vote)
Assignee: Daniel Prusa
URL:
Keywords:
: 45260 (view as bug list)
Depends on: 47453
Blocks: 47545
  Show dependency tree
 
Reported: 2004-08-19 15:51 UTC by Jan Chalupa
Modified: 2007-09-26 09:14 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 Jan Chalupa 2004-08-19 15:51:31 UTC
Reported by a user of NB 4.0 dev build. Reliably
reproducible in NB 4.0 beta 1 build.

Put the following fragment of code into a source file:

static class MyTest extends JButton {
    public MyTest() {
         super("Ok");
         addActionListener(new ActionListener() {
           // *this*
         });
     }
}

When i'm in the the ActionListener class
(currently an empty line marked by *this* comment)
and press <Ctrl>+I the popup appears with the list
of the methods i can override.

All of those methods are methods of JButton and
there are no actionPerformed() method for the
ActionListener itself.
Comment 1 psuk 2004-08-19 17:04:17 UTC
When I tried to reproduce it, I run into Issue 47453 (NPE), marking it
as a blocker for this bug.
Comment 2 Martin Matula 2004-08-19 17:09:16 UTC
This is a known problem. It is because Override method works on top of
the old src hierarchy API which does not know anything about
annonymous classes. This should be fixed as Dan rewrites the Override
methods functionality to JMI.
Comment 3 Martin Matula 2004-08-20 13:52:40 UTC
*** Issue 45260 has been marked as a duplicate of this issue. ***
Comment 4 Daniel Prusa 2004-09-01 15:56:34 UTC
Override Methods and Synchronize actions rewritten.
Comment 5 Jan Chalupa 2004-10-15 22:00:59 UTC
Still doesn't work in custom build of 20041015 sources. Ctrl-I still 
shows all JButton methods, but no 'actionPerformed' for the 
originally reported test case.
Comment 6 Daniel Prusa 2004-10-19 13:16:02 UTC
Did you have java.awt.event.ActionListener imported in the source when
you tried the action ? If this import is missing, ActionListener is
just an unresolved class without any methods, thus no methods are
offered in the dialog (there are only methods related to
java.lang.Object).

This behaviuor is not a regression, NB 3.6 requires the import to be
present as well.
Comment 7 Jan Chalupa 2004-10-19 16:20:29 UTC
Ah, you're probably right. Works for me too in build #200410171800.
Reopening to close as RESOLVED FIXED.
Comment 8 Jan Chalupa 2004-10-19 16:21:38 UTC
RESOLVED FIXED. The original fix seems to work fine.
Comment 9 Jan Chalupa 2004-10-19 16:22:06 UTC
Verified.