Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 207090 - [Inline] Improve selection
[Inline] Improve selection
Product: java
Classification: Unclassified
Component: Refactoring
All All
: P4 (vote)
: 7.2
Assigned To: Ralph Ruijs
Depends on:
  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


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
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;  
         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 <>
Date:      2012-04-11 14:30
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 (upload may still be in progress)
User: Ralph Benjamin Ruijs <>
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