Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 235564

Summary: Rename refactor can break code when new name shadows existing name
Product: java Reporter: David Strupl <dstrupl>
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: briangoetz, dbalek
Version: 7.3   
Target Milestone: 8.0   
Hardware: PC   
OS: All   
Whiteboard:
Issue Type: DEFECT Exception Report:

Description David Strupl 2013-09-05 14:49:21 UTC
This report is about the remaining case from bug report #104551.

This happens with all kinds of variables, not just local variables.  For 
example:

public class Foo {

    public int x;
    
    public class Inner {
        public int y;
        
        public void foo() { 
            y = x + 1;
        }
    }
}

Again, renaming y to x in the inner class, Netbeans changes the assignment, 
changing the semantics of the code, to:
            x = x + 1;

where the right answer is:

            x = Foo.this.x + 1;
Comment 1 Ralph Ruijs 2014-01-07 21:27:27 UTC
changeset   : 0067029ba850
author      : Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date        : Tue Jan 07 16:02:27 CET 2014
summary     : #235564 - Rename refactor can break code when new name shadows existing name
Comment 2 Quality Engineering 2014-01-09 02:56:54 UTC
Integrated into 'main-silver', will be available in build *201401090002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/0067029ba850
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #235564 - Rename refactor can break code when new name shadows existing name
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo