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 244129 - [Introduce method] Introduce method changes variable name incorrectly
Summary: [Introduce method] Introduce method changes variable name incorrectly
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-28 13:39 UTC by Jiri Prox
Modified: 2014-05-25 01:30 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 2014-04-28 13:39:44 UTC
Introduce method changes variable name incorrectly

Steps to reproduce:
1) have a code:
public class Test {
    
    String val;
    
    public void m(String val) {
        this.val = val;
        
        System.out.println(val);
        
    }
}

2) select 
        this.val = val;

   and introduce method from it

->
public class Test {
    
    String val;
    
    public void m(String val) {
        newMethod(val);
        
        System.out.println(val1);   // <---- val1 is not declared!
        
    }

    private void newMethod(String val1) {
        this.val = val1;
    }
}
Comment 1 Svata Dedic 2014-05-02 07:33:09 UTC
Fixed in jet-main#586929209076
Comment 2 Quality Engineering 2014-05-25 01:30:59 UTC
Integrated into 'main-silver', will be available in build *201405250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/586929209076
User: Svata Dedic <sdedic@netbeans.org>
Log: #244129: name replacement is done just in the refactored part of the method