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.
NetBeans IDE Dev (Build 200612061900) 1.6.0-rc; Java HotSpot(TM) Client VM 1.6.0-rc-b104 Windows XP version 5.1 running on x86 en_US (nb); Cp1252 Static import not modified while renaming. Steps to reproduce: 1) have class with static method 2) static import this method to another class (do not use *) 3) rename method -> static import is not changed
See attached screen shot. Problem is, that member select cannot be resolved to proper element, namely selected node in Navigator.
Created attachment 38496 [details] Screen shot
getElement(treePath) for treePath representing member select returns null.
Dusan, could you please take a look on this? Thanks.
Unfortunately, it is as designed that static imports cannot be resoved to proper Elements using Trees.getElement(...) method. Imagine the following case: import static java.lang.Math.abs; Element representing which of the abs(...) methods contained in the Math class should be returned ??? Reassigning back to refactorig guru Honza.
*** Issue 95959 has been marked as a duplicate of this issue. ***
*** Issue 111004 has been marked as a duplicate of this issue. ***
*** Issue 121058 has been marked as a duplicate of this issue. ***
This would be so great... and appears to be trivial. Is it on any milestone? The situation I am thinking of is if I have used a method the old fashioned way... I'd like the hint to pop up and offer to convert it to a static import.
sorry... ignore my last comment, it was meant for issue 89258. I don't know how it ended up here!
What's the status of this? Target milestone is still set to 6.0.
Still no progress
I have partially fixed the problem, now, static import is renamed when the imported element is unambiguously identified by the name and there is at least one usage of the imported element in the given source file. When issue 128815 is fixed the requirement on at least one usage presence will not be needed.
This doesn't work for me. Here's my test case: package test; public class A { public static void foo() { } } package test; import static test.A.foo; public class B { { foo(); } } Now rename foo() in A to bar(). This also renames the call in B, but it does not rename the static import line, causing two compile errors (one because the import referenced the non-existing "foo", another because "bar" is not being imported.) The imported element ("foo") is unambiguously identified, isn't it?
PS: Tested this with 6.1 Beta (Build 200803050202)
The fix is not part of 6.1 beta, it is only in development builds, the scenario described above should work there.
moving opened issues from TM <= 6.1 to TM=Dev
It works for me in NB 6.5. Closing as fixed.
it works for me as well