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 246477 - "Implement All Abstract Methods" generates multiple times the same method
Summary: "Implement All Abstract Methods" generates multiple times the same method
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 251561
Blocks:
  Show dependency tree
 
Reported: 2014-08-15 13:33 UTC by patplu
Modified: 2015-04-12 04:24 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 patplu 2014-08-15 13:33:06 UTC
I create a new class named "TestListModel" , extending "AbstractListModel".
First I fixed the imports with "ctrl+shift+i" but forgot the <String> generic, and directly chose "Import all abstract methods". Then I added the <String> generic and got an error. You can chose "Implement all abstract methods" as often as you want everytime a new "getElementAt()"-method will occur and the bug is reproducable anytime.
Comment 1 Jiri Prox 2014-08-18 08:41:13 UTC
reproducible
Comment 2 Svata Dedic 2015-03-26 15:34:24 UTC
Hm. A simple fix would be to not generate a method iff there is a method with a different signature, but the same erasure. However the produced class would be still incorrect.

Possibly more correct behaviour would be to suggest to CHANGE an existing method to match the current type parameters.

Or even better, make the hint two-step: first suggest to implement all entirely missing methods, then (as a second step), suggest to change existing methods with mismatched signatures. Requires (probably) also to change the result type throughout the method i.e. whenever unqualified or this.qualified method is called.

I'll implement the exclusion first, and keep the rest as an ehnahcement.
Comment 3 Svata Dedic 2015-04-01 13:47:55 UTC
Partially implemented as jet-main#16a551c07a02, keeping rest as enhancement issue #251561
Comment 4 Quality Engineering 2015-04-12 04:24:55 UTC
Integrated into 'main-silver', will be available in build *201504120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/16a551c07a02
User: Svata Dedic <sdedic@netbeans.org>
Log: #246477: prevented generation of conflicting methods in "implement abstract methods" fix