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 238154 - [Introduce Parameter] Should not reformat original method
Summary: [Introduce Parameter] Should not reformat original method
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-08 12:04 UTC by ssazonov
Modified: 2016-07-07 07:18 UTC (History)
1 user (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 ssazonov 2013-11-08 12:04:02 UTC
1. Create any java project and add following java class:

package test;

public class Test {

    public int m(int a, int b){
        System.out.println("abc");
          System.out.println("abc");
            System.out.println("abc");
              System.out.println("abc");
              
        int[][] m = new int[][]{{-1,   2, 5},
                                { 1, -13, 5}};
        return b;
    }
    
    public void m2(){
        m(5, 6);
    }
}

2. Select first "abc" and using Alt+Shift+P invoke Introduce paraeter dialog

3. Uncheck all checkboxes and select "Create New Method and Delegate from Existing method", then press refactor

>> Refactor is performed and reformat method m, so I need to arrange some lines on my own to get original looking:

package test;

public class Test {

    public int m(int a, int b){
        return m(a, b, "abc");
    }

    public int m(int a, int b, String abc){
        System.out.println(abc);
        System.out.println("abc");
        System.out.println("abc");
        System.out.println("abc");
        int[][] m = new int[][]{{-1,   2, 5},
            { 1, -13, 5}};
        return b;
    }
    
    public void m2(){
        m(5, 6);
    }
}

Product Version: NetBeans IDE Dev (Build 201310290001)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Ralph Ruijs 2014-10-20 14:16:46 UTC
changeset:   217d176aea4a                                                
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Mon Oct 20 13:42:55 2014 +0200
summary:     #238154 - [Introduce Parameter] Should not reformat original method
Comment 2 Quality Engineering 2014-10-29 11:42:16 UTC
Integrated into 'main-silver', will be available in build *201410290913* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/217d176aea4a
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #238154 - [Introduce Parameter] Should not reformat original method
Comment 3 Jiri Prox 2014-11-04 08:13:26 UTC
unfortunately I can stil reproduce the original issue (the tests pass correctly, but manualy it is still reproducible)

Product Version: NetBeans IDE Dev (Build 20141104-d5433ace1b92)
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; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 4 Martin Balin 2016-07-07 07:18:37 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss