Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 235564 - Rename refactor can break code when new name shadows existing name
Rename refactor can break code when new name shadows existing name
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Refactoring
7.3
PC All
: P3 (vote)
: 8.0
Assigned To: Ralph Ruijs
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
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
:


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


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