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 63388 - Extract method cannot handle varargs
Summary: Extract method cannot handle varargs
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 09:21 UTC by Jiri Prox
Modified: 2007-09-26 09:14 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 2005-08-31 09:21:35 UTC
NB 4.2 200508301800

Extract method cannot handle situation when one of the input parameters is
vararg type.

Steps to reproduce:
public int adding(int ... x) {
    int sum = 0;
    //------------- begin selection
    for(int a:x) {
         sum +=a;
    }
    //------------- end selection
    return sum;
}

Extract method from selected code
Input parameter x of the new method is generated as 'int' instead of 'int[]'.
Comment 1 Jan Becicka 2005-09-02 08:13:41 UTC
Checking in
src/org/netbeans/modules/refactoring/plugins/ExtractMethodRefactoringPlugin.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/plugins/ExtractMethodRefactoringPlugin.java,v
 <--  ExtractMethodRefactoringPlugin.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/netbeans/modules/refactoring/ui/ExtractMethodPanel.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/ui/ExtractMethodPanel.java,v
 <--  ExtractMethodPanel.java
new revision: 1.8; previous revision: 1.7
done

Fixed on refactoring side. Bug is fixed for described scenario, but still does
not work for:
public int adding(int[] ... x)

problem is, that vararg "int[] ...x" getType() returns "int" but should return
Array of int.
Comment 2 Jan Becicka 2006-10-26 16:27:34 UTC
Javacore module was replaced by Retouche infrastructure. This bug is not valid
in trunk any more.
Comment 3 Jiri Prox 2006-10-27 09:33:27 UTC
verified
Comment 4 Quality Engineering 2007-09-20 10:48:06 UTC
Reorganization of java component