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 211719 - Inline only selected method call
Summary: Inline only selected method call
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-25 14:34 UTC by Jiri Prox
Modified: 2012-04-25 15:01 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2012-04-25 14:34:40 UTC
The only one selected method call should be inlined when inline refactoring is called on method call, not on the method declaration.

Motivation:

1) I have test class:
    @Test
    public void testSelectWord3() {        
        doTest("This is a sample text", 23,"text",10,16);        
    }
    
    @Test
    public void testSelectWord4() {                        
        doTest("This is a  sample text", 10,"",10,10);        
    }

    private void doTest(String text, int caretPos,String res,int start, int end) {
        Selection result = Utils.selectWord(text, caretPos);
        assertEquals(res,text.subSequence(result.getStart(), result.getEnd()));        
        assertEquals(10, result.getStart());
        assertEquals(10, result.getEnd());
    }

2) I want to modify the testSelectWord4 to do something slightly different than doTest do. So I would select the doTest call and invoke inline

Current state:
All doTest calls are inlined. So I have to use copy/paste and manually correct the method parameters

Expected state:
Only one call is inlined and I can continue with modifying the code
Comment 1 Ralph Ruijs 2012-04-25 15:01:00 UTC
After a small discussion with Jirka, the problem consists of two parts.

The most logical solution would be to invoke inline and unselect the changes the user does not want. In this case all except the one occurrence. This is not easy to do because of #206043.

A more consistent solution would be to have the option "inline all occurrences". But, instead of creating a configuration dialog, should probably work inplace, like rename.