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 225981 - flip operands in commutative operation
Summary: flip operands in commutative operation
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
: 225984 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-11 13:25 UTC by lforet
Modified: 2015-05-11 01:18 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
instruction (281.92 KB, application/pdf)
2015-05-11 01:06 UTC, Eliot45
Details
instruction2 (5.09 KB, text/html)
2015-05-11 01:18 UTC, Eliot45
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lforet 2013-02-11 13:25:39 UTC
It will be cool if we can flip between operands in commutative operation

boolean a,b = true,c = true;

a = b & c;  // suggest flip
-->
a = c & b

Other useful example :

if (longverylongbooleanexpression && anotherbooleanexpression) {}
-flip operands-> 
if (longverylongbooleanexpression && anotherbooleanexpression) {}
Comment 1 markiewb 2013-02-11 16:01:16 UTC
You could use a custom inspection. For example

<!description="Flip operands">
$a & $b
=>
$b & $a
;;
$a && $b
=>
$b && $a
;;

$a || $b
=>
$b || $a
;;
Comment 2 lforet 2013-02-11 16:13:04 UTC
Indeed custom inspections are very powerfull but need configuration and are hard to use it : no shortcut , two contextual menus and a very hard way to chose from of a very big list of choices.

The idea is to provide that kind of power while editing the code.
Comment 3 markiewb 2013-02-11 16:36:29 UTC
(In reply to comment #2)
> Indeed custom inspections are very powerfull but need configuration and are
> hard to use it : no shortcut , two contextual menus and a very hard way to
> chose from of a very big list of choices.
> 
> The idea is to provide that kind of power while editing the code.

See my comment at http://netbeans.org/bugzilla/show_bug.cgi?id=225984#c3
Comment 4 Quality Engineering 2013-05-02 14:10:34 UTC
Integrated into 'main-golden', will be available in build *201305021042* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/907c037cdcdb
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #225981: adding flip operation suggestion.
Comment 5 markiewb 2014-05-14 16:11:14 UTC
*** Bug 225984 has been marked as a duplicate of this bug. ***
Comment 6 markiewb 2014-05-14 16:12:50 UTC
(In reply to Quality Engineering from comment #4)
> Integrated into 'main-golden', will be available in build *201305021042* on
> http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
> Changeset: http://hg.netbeans.org/main-golden/rev/907c037cdcdb
> User: Jan Lahoda <jlahoda@netbeans.org>
> Log: #225981: adding flip operation suggestion.

Resolving this issue as fixed in 7.4 timeline.

(org.netbeans.modules.java.hints.suggestions.FlipOperands)
Comment 7 Eliot45 2015-05-11 01:06:29 UTC
Created attachment 153591 [details]
instruction
Comment 8 Eliot45 2015-05-11 01:18:59 UTC
Created attachment 153592 [details]
instruction2