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.
Steps to reproduce: - Open a form with at least one named component; - Delete the named component; - Add another component and invoke Change variable name, with the name of the deleted component The IDE doesn't allow the renaming operation to complete stating there is a component with said name already. Workaround: Save form after deleting and before trying the rename operation. Product Version = NetBeans IDE Dev (Build 20110815-46e7ed429e28) Operating System = Windows 7 version 6.1 running on x86 Java; VM; Vendor = 1.6.0_19 Runtime = Java HotSpot(TM) Client VM 16.2-b04
This bug is caused by lazy regeneration of the source code of the form. The deleted component is removed from the form model, but the corresponding field remains in the .java file (till the form is saved or till the user switches to Source tab). Unfortunately, the code that performs the renaming also checks the presence of a field in .java file. Hence, it refuses to perform a rename to "already existing" field.
Fixed by forcing code regeneration before rename. Modified file: http://hg.netbeans.org/jet-main/rev/00a7aebc2336