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 236453 - Refactoring "Introduce Method" doesn't create return statement
Summary: Refactoring "Introduce Method" doesn't create return statement
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-27 09:36 UTC by k_sch
Modified: 2016-07-07 07:18 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 k_sch 2013-09-27 09:36:34 UTC
Product Version = NetBeans IDE 7.4 Beta (Build 201307092200)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_25
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.25-b01

New Java Project; class as follows:
"
package test;

public class TestMethod
{
    public boolean getCondition1()
    {
        final String s = "s1";
        final boolean isS = Boolean.parseBoolean( s );
        return isS;
    }
    
    public boolean getCondition2()
    {
        final String s = "s2";
        final boolean isS = Boolean.parseBoolean( s );
        return isS;
    }
}
"
Marking Lines 8/9
"
        final boolean isS = Boolean.parseBoolean( s );
        return isS;
"
and executing "Introduce Method". New function name "getBoolean", accepting "alter semantics".
Result:
"
package test;

public class TestMethod
{
    public boolean getCondition1()
    {
        final String s = "s1";
        return getBoolean( s );
    }
    
    public boolean getCondition2()
    {
        final String s = "s2";
        getBoolean( s );
    }

    private boolean getBoolean( final String s )
    {
        final boolean isS = Boolean.parseBoolean( s );
        return isS;
    }
}
"
In getCondition2 the return statement is missing. 
In my opinion this should be handled in the same way as in getCondition1.
Comment 1 Martin Balin 2016-07-07 07:18:55 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss