| Summary: | [quick assist] Invert conditions generates incorrect code | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Viliam Durina <viliam> | ||||
| Component: | UI | Assignee: | Deepak Azad <deepakazad> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | deepakazad | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7 M5 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Viliam Durina
-------------------------------------------------------
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. |