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 238301 - [Introduce parameter] Breaks code if apply on condition
Summary: [Introduce parameter] Breaks code if apply on condition
Status: VERIFIED 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: 2013-11-13 10:39 UTC by ssazonov
Modified: 2014-11-11 12:16 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Before / After (95.09 KB, image/png)
2014-01-10 09:34 UTC, ssazonov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ssazonov 2013-11-13 10:39:16 UTC
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. Select "i" in condition "if (i > 5) {...}" and using Alt+Shift+P invoke Introduce Parameter dialog

3. Set it according the attached image and pres Refactor

>> Refactor breaks if (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 2014-01-08 00:25:39 UTC
Image is not attached. I tried the supplied steps, but this works for me.
Comment 2 ssazonov 2014-01-10 09:34:15 UTC
Sorry, I forgot to attache the image. I mannaged to reproduce the bug: select whole condition (i > 5) and using Alt+Shift+P invoke Introduce Parameter dialog, set it according the image and press Refactor

>> it generates incompilable code

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 3 ssazonov 2014-01-10 09:34:41 UTC
Created attachment 143776 [details]
Before / After
Comment 4 Ralph Ruijs 2014-10-20 11:08:50 UTC
changeset:   d629864db55d
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Mon Oct 20 12:22:17 2014 +0200
summary:     #238301 - [Introduce parameter] Breaks code if apply on condition
Comment 5 Quality Engineering 2014-10-29 11:42:12 UTC
Integrated into 'main-silver', will be available in build *201410290913* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d629864db55d
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #238301 - [Introduce parameter] Breaks code if apply on condition
Comment 6 Jiri Prox 2014-11-04 08:41:03 UTC
verified
Comment 7 Quality Engineering 2014-11-10 23:20:25 UTC
Integrated into 'releases/release801', will be available in build *201411102027* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/b760a7544834
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #238301 - [Introduce parameter] Breaks code if apply on condition