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 165782 - [introduce method] introducing existing method allowed
Summary: [introduce method] introducing existing method allowed
Status: RESOLVED DUPLICATE of bug 106501
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All Windows Vista
: P3 blocker (vote)
Assignee: Max Sauer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-22 10:37 UTC by matusdekanek
Modified: 2009-05-22 13:44 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 matusdekanek 2009-05-22 10:37:40 UTC
Product Version: NetBeans IDE Dev (Build 200905190001)
Java: 1.6.0_14-ea; Java HotSpot(TM) Client VM 14.0-b12
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)

have somewhere in the code a line
--------------------
int a = 0;
--------------------
select the line and invoke refactor|introduce method, confirm the dialog (with some name)
the resultant code will be like
--------------------
int a = foo();
--------------------
and a new method will be in the class
--------------------
int foo(){
    int a = 0;
    return a;
}
--------------------
now select the line 'int a = foo();' and invoke refactor|introduce method. In the dialog insert the same name as before 
(in this case 'foo') and confirm.
No warning is shown, and the code is now like
--------------------
int foo(){
    int a = 0;
    return a;
}

int foo(){
    int a = foo();
    return a;
}

...
int a = foo()
...
--------------------
Comment 1 matusdekanek 2009-05-22 11:43:07 UTC
the same applies to 'introduce field' - it is possible to create duplicite fields.
Comment 2 matusdekanek 2009-05-22 11:47:13 UTC
It even seems to apply to introducing anything(constants, method, field, variable).
Comment 3 Max Sauer 2009-05-22 13:44:32 UTC
Already filed, thanks anyway.

*** This issue has been marked as a duplicate of 106501 ***