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 202571 - [71cat] refactoring: rename
Summary: [71cat] refactoring: rename
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jan Becicka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-23 15:21 UTC by muellermi
Modified: 2016-08-01 20:06 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 muellermi 2011-09-23 15:21:30 UTC
Product Version = NetBeans IDE Dev (Build 201109180600)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.7.0
Runtime = Java HotSpot(TM) Client VM 21.0-b17

given a pai of getter/setter, e.g.

public int getSomeId (){...}
public void setSomeId (int newId){..}

Now I place the cursor above getSomeId and call "rename". I change it to "getSomeKey". All usages will be updated.
All usages? Yes, even though it is used in a JSF page.
But now, the access from JSF is broken: to set a value, the setter has to be renamed too.

On the other hand, if you perform rename on the setter, all usages except JSF (maybe some others too) are renamed. Used as property in JSF, manual update is needed.

Conclusion: Perform rename on getter/setter simultanously.
Comment 1 muellermi 2015-07-04 21:46:42 UTC
Java:

  public String getTitle() {
    return _title;
  }

  public void setTitle(String title) {
    _title = title;
  }

XHTML:

<h:inputText id="title" styleClass="inputFull" value="#{bookEditor.book.title}">

Rename on getTitle renames the getter and all its usages. After renaming to getTitleXXX:

  public String getTitleXXX() {
    return _title;
  }

  public void setTitle(String title) {
    _title = title;
  }

<h:inputText id="title" styleClass="inputFull" value="#{bookEditor.book.titleXXX}">

Next, perform a rename back to getTitle()

  public String getTitle() {
    return _title;
  }

  public void setTitle(String title) {
    _title = title;
  }

<h:inputText id="title" styleClass="inputFull" value="#{bookEditor.book.titleXXX}">

The page isn't renamed any more in this situation.

That's why I changed this issue from enhancement to defect.

And, after the first rename (to getTitleXXX) find usage would not find the usage within the page anymore. Please refer to bug https://netbeans.org/bugzilla/show_bug.cgi?id=252986

The problem might be solved by querying the user on rename, e.g. "You are going to rename a getter. Would youl like to rename the setter from setTitle() to setTitleXXX() too?"
Comment 2 Martin Balin 2016-07-07 07:31:33 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 3 muellermi 2016-08-01 20:06:10 UTC
seems to be solved during the meantime