Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 207090 - [Inline] Improve selection
[Inline] Improve selection
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Refactoring
7.1
All All
: P4 (vote)
: 7.2
Assigned To: Ralph Ruijs
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-09 20:48 UTC by muellermi
Modified: 2012-04-13 09:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description muellermi 2012-01-09 20:48:24 UTC
Product Version = NetBeans IDE 7.1 (Build 201112051121)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_02
Runtime = Java HotSpot(TM) 64-Bit Server VM 22.0-b10

according to http://wiki.netbeans.org/NewAndNoteworthyNB71#Inline
in calculatePrice the assignement of basePrice should be removed and all other occurenced should be replaced by "getBasePrice"

    double BASEPRICE = 2000;
    
    public double calculatePrice() {
        double basePrice = getBasePrice();
        if (basePrice > 1000) {
         return basePrice * 0.95;  
        }else{
         return basePrice * 0.98;      // mark this line and choose refactoring -> inline
        }
    }

    private double getBasePrice() {
        return BASEPRICE;
    }

But, NB alerts, a method with multiple return statements cannot be refactored by inline
Comment 1 Ralph Ruijs 2012-01-10 13:32:40 UTC
Selecting a whole line in the method (I think this is what you meant with mark) and then choose Inline, will start the Inline Method Refactoring for calculatePrice().

To inline the temporary variable basePrice; place the cursor on the variable name or select the variable name and choose Refactor->Inline...

I changed the bug to improve the selection, as selecting the whole variable declaration statement, incorrectly starts Inline Method.

Thanks for the report.
Comment 2 Ralph Ruijs 2012-04-11 12:31:42 UTC
Changeset: f07629ac63a5
Author:    Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Date:      2012-04-11 14:30
Message:   
Issue #207090 - [Inline] Improve selection
Comment 3 Quality Engineering 2012-04-13 09:51:54 UTC
Integrated into 'main-golden', will be available in build *201204130400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f07629ac63a5
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Issue #207090 - [Inline] Improve selection


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo