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 215137 - Field rename refactoring does not work as expected
Summary: Field rename refactoring does not work as expected
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.2
Hardware: PC Linux
: P2 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-03 17:39 UTC by Michel Graciano
Modified: 2012-09-07 08:40 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Buggy refactoring sample (13.59 KB, application/zip)
2012-07-03 18:38 UTC, Michel Graciano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2012-07-03 17:39:28 UTC
[ JDK VERSION : 1.7.5 ]

Given the follow class:

public class Issue {
    private String abcd;

    public String getAbcd() {
        return abcd;
    }

    private void setAbcd(String abcd) {
        this.abcd = abcd;
    }
}

1. Put the cursor at 'abcd' field;
2. Go to Refactor > Rename and rename it to 'abcde' and mark option 'Rename
Getters and Setters'

the result is that the field is renamed but the getter/setter is not. If you
try it when both get/set are public, it works fine but the expected behaviour
is that it should work even if both are private.
Comment 1 Michel Graciano 2012-07-03 17:39:47 UTC
Product Version: NetBeans IDE 7.2 (Build 201206291011)
Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03
System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; en_US (nb)
Comment 2 Michel Graciano 2012-07-03 18:38:00 UTC
Created attachment 121706 [details]
Buggy refactoring sample

Ok, it is really worse as I expected. The refactoring works really buggy if the selected token is not the declaration field. If you do the refactoring (or the preview) selecting 'abc' field shown at Issue class, line 5, everything works as expected, even private rename. But, If you try the refactoring selecting the 'abc' field inside the code, for exemplo, putting the cursor at line 8, column 18, the refactoring is not performed as expected, actually just the field is refactored.
Comment 3 Ralph Ruijs 2012-07-04 14:32:23 UTC
Changeset: 1e6595e5e394
Author:    Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Date:      2012-07-04 16:17
Message:   
Issue #215137 - Field rename refactoring does not work as expected
Comment 4 Michel Graciano 2012-07-04 14:40:42 UTC
Do you think it is possible to have it backported to 7.2 as a future patch?
Comment 5 Ralph Ruijs 2012-07-04 14:45:41 UTC
(In reply to comment #4)
> Do you think it is possible to have it backported to 7.2 as a future patch?

Yes, I do not see a problem with this. Jirka?
Comment 6 Jiri Kovalsky 2012-07-07 19:59:34 UTC
If it's me being asked, I am not against.
Comment 7 Quality Engineering 2012-07-08 02:53:21 UTC
Integrated into 'main-golden', will be available in build *201207080002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1e6595e5e394
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Issue #215137 - Field rename refactoring does not work as expected
Comment 8 Michel Graciano 2012-07-09 13:14:17 UTC
Build 20120709-7bce6e2cc8f3
Comment 9 Ralph Ruijs 2012-08-31 12:37:43 UTC
http://hg.netbeans.org/releases/rev/91071ddc43d8
Comment 10 Quality Engineering 2012-09-01 11:06:23 UTC
Integrated into 'releases', will be available in build *201209010822* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/91071ddc43d8
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Issue #215137 - Field rename refactoring does not work as expected