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.
Summary ======= When using Refactor => Move to relocate a method to another class, the return type of that method is changed from List<String> to List. Steps to reproduce ================== [1] Create a trivial Java application named TestRefactorMove with two classes in file TestRefactorMove.java as follows: package testrefactormove; import java.util.ArrayList; import java.util.List; public class TestRefactorMove { public static void main(String[] args) { List<String> list1 = new ArrayList<>(); list1.add("AAA"); list1.add("BBB"); List<String> list2 = lowerMembers(list1); System.out.println("Before: " + list1.toString()); System.out.println("After: " + list2.toString()); } public static List<String> lowerMembers(List<String> list) { List<String> lower = new ArrayList<>(); for (String s : list) { lower.add(s.toLowerCase()); } return lower; } } class SomethingElse { } [2] Build and run the app to verify that it works. [3] Place the cursor on the static method named "lowerMembers", right-click, then select Refactor => Move. [4] In the "Move Members" dialog select "SomethingElse" from the "To class" drop list, then click the "Refactor" button. [5] The method is moved, but note that the return type of the moved method SomethingElse.lowerMembers() has been changed from "List<String>" to a raw "List". This example moves a static method, but the problem can be reproduced with non-static methods. Environment =========== Product Version: NetBeans IDE 8.0.1 (Build 201408251540) Java: 1.8.0_20-ea; Java HotSpot(TM) 64-Bit Server VM 25.20-b22 Runtime: Java(TM) SE Runtime Environment 1.8.0_20-ea-b23 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) User directory: C:\Users\JohnDoe\AppData\Roaming\NetBeans\8.0.1 Cache directory: C:\Users\JohnDoe\AppData\Local\NetBeans\Cache\8.0.1
reproducible
changeset: fa02f2f1d0fd user: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org> date: Wed Oct 08 16:16:33 2014 +0200 summary: #247462 - Generic type information lost when using Refactor => Move for a Java method
Integrated into 'main-silver', will be available in build *201410180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/fa02f2f1d0fd User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org> Log: #247462 - Generic type information lost when using Refactor => Move for a Java method
FYI, I retested and I confirm that the fix works in the following environment: Product Version: NetBeans IDE Dev (Build 201410190001) Updates: Updates available Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02 Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b18 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) User directory: C:\Users\JohnDoe\AppData\Roaming\NetBeans\dev Cache directory: C:\Users\JohnDoe\AppData\Local\NetBeans\Cache\dev Thanks.
thanks for verification
Integrated into 'releases/release801', will be available in build *201411102027* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/7fae5b41f131 User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org> Log: #247462 - Generic type information lost when using Refactor => Move for a Java method