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

Summary: Implement all abstract methods does not consider default method of the interface
Product: java Reporter: Jachym_Vojtek
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 258981    
Bug Blocks:    

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