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 240191 - [Introduce paramete] wrong recognition on which part of code it should be applied (in condition)
Summary: [Introduce paramete] wrong recognition on which part of code it should be app...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-10 09:44 UTC by ssazonov
Modified: 2015-04-15 02:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
4 different cases (17.86 KB, image/png)
2014-01-10 09:44 UTC, ssazonov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ssazonov 2014-01-10 09:44:59 UTC
Created attachment 143779 [details]
4 different cases

1. Create new simple java class:

package test;

public class ClassA {

	public void m1(){
		m2(1);
	}

	public void m2(int i){
		if (i > 5) {
			System.out.println("abcd");
		}
	}
}

2. Using Alt+Shift+P invoke Introduce parameter in condition (i > 5) in 4 different cases:

a. Parameter i is selected and caret is at position (i| > 5)
b. Parameter i is selected and caret is at position (|i > 5)
c. Nothing is selected and caret is at position (|i > 5)
d. Nothing is selected and caret is at position (i| > 5)

>> In cases 2a-2c refactoring is applied on whole condition (i > 5), I think at least in cases 2a,2b it should be applied only on "i" instead of "(i > 5)"

(see attached image)

Product Version: NetBeans IDE Dev (Build 201311120002)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Ralph Ruijs 2015-04-14 10:02:08 UTC
changeset:   e3bb3d951c64
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Tue Apr 14 11:55:18 2015 +0200
summary:     #240191 - [Introduce paramete] wrong recognition on which part of code it should be applied (in condition)
Comment 2 Quality Engineering 2015-04-15 02:49:42 UTC
Integrated into 'main-silver', will be available in build *201504150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e3bb3d951c64
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #240191 - [Introduce paramete] wrong recognition on which part of code it should be applied (in condition)