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.
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) {}
You could use a custom inspection. For example <!description="Flip operands"> $a & $b => $b & $a ;; $a && $b => $b && $a ;; $a || $b => $b || $a ;;
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.
(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
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.
*** Bug 225984 has been marked as a duplicate of this bug. ***
(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)
Created attachment 153591 [details] instruction
Created attachment 153592 [details] instruction2