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.
If I select a method and use Refactor>>Invert Boolean, all methods with a return value have "!" written before their return value. BEFORE: public class NewClass { boolean b = true; public boolean someMethod() { return true; } public String methodMethod2() { return "Hello World!"; } public boolean crazyOtherMethod() { return b; } public int returnInt() { return 1099; } public Object returnObj() { return this; } } AFTER INVERT BOOLEAN ON someMethod(): public class NewClass { boolean b = true; public boolean someMethod() { return false; } public String methodMethod2() { return !"Hello World!"; } public boolean crazyOtherMethod() { return !b; } public int returnInt() { return !1099; } public Object returnObj() { return !this; } }
P1 if reproducible
Changeset: 23976537b2a2 Author: Jan Becicka <jbecicka@netbeans.org> Date: 2012-04-11 15:22 Message: Issue #210971 - Invert Boolean Writes "!" Before All Return Values Of All Methods
Integrated into 'main-golden', will be available in build *201204130400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/23976537b2a2 User: Jan Becicka <jbecicka@netbeans.org> Log: Issue #210971 - Invert Boolean Writes "!" Before All Return Values Of All Methods
Now it turns b into !$enclosing.b in the 3rd method when I invert b to false. If I rename the variable to c when prompted in the inversion process, it works. See below. public class NewClass { boolean b = false; public boolean someMethod() { return true; } public String methodMethod2() { return "Hello World!"; } public boolean crazyOtherMethod() { return !$enclosing.b; } public int returnInt() { return 1099; } public Object returnObj() { return this; } } Product Version: NetBeans IDE Dev (Build 201204130400) Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02 System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)
Created attachment 118306 [details] Test covering last usecase
http://hg.netbeans.org/jet-main/rev/ceb3b8ba0018
Integrated into 'main-golden', will be available in build *201204181547* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/ceb3b8ba0018 User: Jan Lahoda <jlahoda@netbeans.org> Log: #210971: rewrite $this.field=>$this.field should work also when $this is implicit and the result is actually resolvable. Also passing constraints to declarative JavaFix on creation.