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 269333

Summary: [inline] Inline method does not handle generics correctly
Product: java Reporter: Jiri Prox <jiriprox>
Component: RefactoringAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description Jiri Prox 2016-12-14 10:31:35 UTC
Inline method does not handle generics correctly

Steps to reproduce:
1) have a class:
public class GenClass<X> {
        
    public void method(X ... args) {        
    }    
    public void m2() {
        GenClass<String> i1 = new GenClass<>();
        i1.method("a","b");
    }
    
    public void m2(X x) {
        GenClass<X> i1 = new GenClass<>();
        i1.method(x);
    }
}
2) inline "method(X ... args)"

->
public class GenClass<X> {
        
    public void m2() {
        GenClass<String> i1 = new GenClass<>();
        X[] args = new X[]{"a", "b"};  //<-- Should be String[] args = new String[] .....
    }
    
    public void m2(X x) {
        GenClass<X> i1 = new GenClass<>();
        X[] args = new X[]{x};  //<---- generic method creation
    }
}


Product Version: NetBeans IDE 8.2 (Build 201609300101)
Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 1
Java: 1.8.0_111; Java HotSpot(TM) 64-Bit Server VM 25.111-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_111-b14
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\8.2
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\8.2