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 121733 - Class deleted after a method safe delete refactoring
Summary: Class deleted after a method safe delete refactoring
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-12 14:04 UTC by cfd
Modified: 2009-11-02 11:16 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 cfd 2007-11-12 14:04:25 UTC
Cleaning methods with refactoring is dangerous if you select more than one method in a row.

Just right-click on a unused method name (or into the unused method) > refactor > safe delete... > preview

-> ok, this method will be deleted.

Select 2 methods (with both whole logical blocks) > refactor > safe delete... > preview

-> ko, the entire class will be deleted.

from the about: 
Product Version: NetBeans IDE 6.0 Beta 2 (Build 200710212201)
Java: 1.6.0_01; Java HotSpot(TM) Client VM 1.6.0_01-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
Comment 1 Jan Becicka 2007-11-12 15:36:43 UTC
This refactoring is sensitive to cursor position, not editor selection.
I guess, that if you selected 2 methods and invoked [Refactor | Safe Delete], cursor was not inside any method, but
inside class and this is why class gets deleted.
Comment 2 cfd 2007-11-13 06:36:39 UTC
You're right, the cursor position is the key.
Select 2 methods but not the last '}' (so the cursor stays into the last method block) > refactor > safe delete... > preview

-> ok, only the second method will be deleted.

Quite dangerous, so ALWAYS preview the refactoring process :)
Comment 3 David Strupl 2009-03-31 15:55:54 UTC
Resolving all issues with milestone "future" as LATER. If you feel strongly that
it should be implemented please reopen and set the target milestone to "next".
Comment 4 Quality Engineering 2009-11-02 11:16:52 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX