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 255009

Summary: [Introduce method] When introducing method from interface the new method should be static
Product: java Reporter: Jiri Prox <jiriprox>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description Jiri Prox 2015-09-04 14:16:21 UTC
When introducing method from code within interface, the new method is not static.

Steps to reproduce:
1) hava a class

public class Test {
    interface Iface {
        default void m() {
            System.out.println("");
        }
        
    }
}

2) select the body of m() and invoke introduce method
3) as target type select Test
->

public class Test {
    interface Iface {
        default void m() {
            newMethod();  //<------------ non-static newMethod cannot called
        }
        
    }

    public void newMethod() {
        System.out.println("");
    }
}



Product Version: NetBeans IDE Dev (Build 201509030002)
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 1 Svata Dedic 2015-09-08 11:49:32 UTC
Fixed in jet-main#09d8ec7532d6
Comment 2 Quality Engineering 2015-09-10 01:29:21 UTC
Integrated into 'main-silver', will be available in build *201509100002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/09d8ec7532d6
User: Svata Dedic <sdedic@netbeans.org>
Log: #255009: make method static if code moves out of an interface