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 - [inline] Inline method does not handle generics correctly
Summary: [inline] Inline method does not handle generics correctly
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-14 10:31 UTC by Jiri Prox
Modified: 2016-12-14 10:31 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 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