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 208022 - Refactoring Change Method Parameters - adding varargs doesn't work correctly
Summary: Refactoring Change Method Parameters - adding varargs doesn't work correctly
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1
Hardware: All All
: P2 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-02 15:18 UTC by ttokoly
Modified: 2012-02-16 09:32 UTC (History)
2 users (show)

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 ttokoly 2012-02-02 15:18:30 UTC
Product Version: NetBeans IDE 7.1 (Build 201112071828)
Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

1. Unzip a project default to some work directory - there is link:
http://wiki.netbeans.org/wiki/images/2/2e/Default_STS_68_Refactoring.zip
2. Start IDE with a clean userdir.
3. Invoke File | Open Project... action.
4. Select unzipped projects default.
5. Scanning structure of project should be performed (it takes a while).

6. Put caret over make(int index, String s, Bean bean) in the org.netbeans.tests.examples.packc.Makable class.
7. Invoke Refactoring | Change Method Parameters action from the popup menu
8. Add new argument of type "int...", fill in some name
9. Enter 1,2,3 as default value
10. Perform refactoring 

EXPECTED RESULT: The refactoring cannot continue if vararg parameter is not at the last position. If refactoring is performed method declaration is modified as expected and provided default values are added to all calls of refactored method (Note you have to set project source level to 1.5) (10 occurrences) 

According to the Refactoring Test Specifications (
http://wiki.netbeans.org/TS_60_Refactoring -> Vararg ) expected
result is that the when refactoring is performed method declaration is modified as expected and provided default values are added to all calls of refactored method.

But instead of changing method make in class Makable on line 18 from:

public void make(int index, String s, Bean bean);

to

public void make(int index, String s, Bean bean, int... name);

it is changed to:

public void make(int index, java.lang.String s, org.netbeans.tests.examples.packa.Bean bean, int...... name);

Where problem is three extra dots, so project is no longer compilable.

Note: this is happening to all occurrences of method make, not only in Makable class.

P.S.: I'm not sure if changing type from relative to full path is correct behavior.
Comment 1 Ralph Ruijs 2012-02-06 12:30:28 UTC
changeset   : http://hg.netbeans.org/jet-main/rev/350695c40389
author      : Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date        : Mon Feb 06 13:20:47 CET 2012
summary     : Issue #208022 - Refactoring Change Method Parameters - adding varargs doesn't work correctly


Changing of the type to the fqn is also fixed.
Comment 2 ttokoly 2012-02-13 11:17:09 UTC
Product Version: NetBeans IDE Dev (Build 201202130400)
Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

Veryfied, works for me now :) . Thanks.
Comment 3 Ralph Ruijs 2012-02-13 16:26:03 UTC
Transplanted to release71_fixes:
7d085a94b1c2
8f393ef82324
Comment 4 Quality Engineering 2012-02-14 02:32:12 UTC
Integrated into 'releases', will be available in build *201202132200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/7d085a94b1c2
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Issue #208022 - Refactoring Change Method Parameters - adding varargs doesn't work correctly
Comment 5 Jiri Prox 2012-02-16 09:32:20 UTC
verified in patch1