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 238057 - [Invert Boolean] Makes incompilable code if result is not accessed to variable
Summary: [Invert Boolean] Makes incompilable code if result is not accessed to variable
Status: RESOLVED WONTFIX
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-06 14:58 UTC by ssazonov
Modified: 2016-07-07 07:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
error (55.89 KB, image/png)
2013-11-06 14:58 UTC, ssazonov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ssazonov 2013-11-06 14:58:28 UTC
Created attachment 141907 [details]
error

1. Create new simple java class:

package test;

public class Test {

	public void m(){
		m1(3, 4, 5);
		System.out.println(m1(3, 4, 5));
	}
	
	public boolean m1(int a, int b, int c){
		if (a * a + b * b == c * c) {
			return true;
		}
		return false;
	}
}

2. put caret into "System.out.println(m|1(3, 4, 5));" where '|' is a position of carat

3. From main menu select Refactor > Invert Boolean... and confirm dialog

>> It creates incompilable code:
>>	...
>>	public void m(){
>>		!m1(3, 4, 5); // error
>>		System.out.println(!m1(3, 4, 5));
>>	}
>>	...

Product Version: NetBeans IDE Dev (Build 201310290001)
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-10-20 14:17:16 UTC
changeset:   0638bcca5827
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Mon Oct 20 16:09:37 2014 +0200
summary:     #238057 - [Invert Boolean] Makes incompilable code if result is not accessed to variable
Comment 2 Quality Engineering 2014-10-29 11:40:54 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/0638bcca5827
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #238057 - [Invert Boolean] Makes incompilable code if result is not accessed to variable
Comment 3 Jiri Prox 2014-11-03 11:51:28 UTC
Unfortunately the issue is still reporducible on the code provided by Standa.



Product Version: NetBeans IDE Dev (Build 201411030002)
Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b18
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 4 Martin Balin 2016-07-07 07:18:06 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss