Community
Participate
Working Groups
I20101206-1800 Exchange operands quick assist must add parentheses sometimes, e.g. when invoked on the second != in these statements: static void foo(int a, long b) { System.out.println(b != 0 != (a == b)); System.out.println(b != 0 != true); }
This is not a new problem, it was always there for == operator static void foo(int a, long b) { System.out.println(b == 0 == (a == b)); System.out.println(b == 0 == true); }
Created attachment 187136 [details] fix + tests With the patch parenthesis will be added for both of the following statements. static void foo(int a, long b) { System.out.println(b != 0 != (a == b)); // Ctrl+1 on second != System.out.println(b > 0 != (a == b)); // Ctrl+1 != } I think it is better to add extra parenthesis in some cases, than produce code with errors.
Fixed in HEAD.