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 235564 - Rename refactor can break code when new name shadows existing name
Summary: Rename refactor can break code when new name shadows existing name
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.3
Hardware: PC All
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-05 14:49 UTC by David Strupl
Modified: 2014-01-09 02:56 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 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