Community
Participate
Working Groups
Build Identifier: 20100917-0705 Let a and b be of Object type, the following expression: a == null ^ b == null is inverted incorrectly to: !a == null ^ b == null which does not compile (The operator ! is undefined for the argument type(s) Object). The correct result should be: a != null ^ b == null It seems, that left-hand side argument is simply prefixed with !, but it should be recursively inverted as a separate expression. Reproducible: Always
------------------------------------------------------- void foo(Object a, Object b) { if(a == null ^ b == null ){ } } ------------------------------------------------------- Invert conditions quick assist results in the following => Parentheses are missing ------------------------------------------------------- void foo(Object a, Object b) { if(!a == null ^ b == null ){ } } -------------------------------------------------------
I will take a look. Fix will go in AdvancedQuickAssistProcessor.getInversedExpression(ASTRewrite, Expression, SimpleNameRenameProvider) line 533. In the fall back case we should first create a ParenthesizedExpression and then invert it.
Created attachment 187354 [details] fix+test
Fixed in HEAD.