Bug 241067 - Rename refactoring not possible on method usage
Rename refactoring not possible on method usage
Status: NEW
Product: groovy
Classification: Unclassified
Component: Refactoring
PC Linux
: P3 (vote)
Assigned To: Martin Janicek
Depends on:
  Show dependency treegraph
Reported: 2014-01-28 14:39 UTC by Vladimir Riha
Modified: 2014-01-28 14:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT

IDE log (49.78 KB, text/plain)
2014-01-28 14:39 UTC, Vladimir Riha

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2014-01-28 14:39:04 UTC
Created attachment 144473 [details]
IDE log

In JavaSE project, please try to:

 - create a new Groovy class in package "generators" called Bara with following content:

package generators

class Bara {
  void pokus() {
     println "foobar"

 - in the same package, create a Groovy script file and paste

c = new Bara() 

 - click on "pokus" in this script file and press Ctrl+R to refactor|rename

=> IDE says "The rename refactoring cannot be applied in this context" but it works if you try it from the Bara class as such

Product Version: NetBeans IDE Dev (Build 201401280001)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b66
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b125
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 Martin Janicek 2014-01-28 14:46:49 UTC
It's basically done for purpose (at least it was made like this in the first -and unfortunately also the last - iteration or implementing refactoring features for Groovy).

Since your declaration of "c" doesn't use any kind of static type, editor doesn't have any idea about the dynamic type it will contain when the refactoring is invoked. Because of that I can either refuse the refactoring or find all classes implementing method called "pokus" with zero parameters and ask user which one he want to use.

Obviously the first solution was easier (and also faster :P) for the first refactoring, that's why I wouldn't expect this to work at the moment.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo