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 256798 - Implement all abstract methods does not consider default method of the interface
Summary: Implement all abstract methods does not consider default method of the interface
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 258981
Blocks:
  Show dependency tree
 
Reported: 2015-11-26 08:10 UTC by Jachym_Vojtek
Modified: 2016-05-16 07:36 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-11-26 08:10:56 UTC
Consider the example:
package testImplementDefaultMethodHint;

public class ImplementDefaultMethodHint {

    I i = new I() {

    }
}

interface I {
    void x();
    void y();
    default void z() {}
}


1) Notice the hint offered on line where new instance of anonymous class is created.
2) When hint "Implement all abstract methods" is applied it does not add the method z()

I understand that z() in fact is not an abstract method. So technically this is maybe correct.

But what if I (ab)used default modifier to make an API compatible change in the interface I which had existed a long time before method z() was added? The default method is then the only possibility I had. And in this situation it is a method that I want to be implemented by classes that implement interface I.

How many other possibilities there are to find out that method z() can be implemented? Luckily there is code completion. But Generate Override Methods does not offer z(). Let's imagine that there are no sources for interface I available. Not easy situation to implement interface I properly, do you agree?
Comment 1 Svata Dedic 2016-05-16 07:36:21 UTC
Fixed by http://hg.netbeans.org/jet-main/rev/48788f14f954