SonarLint:Simplify the expression wrong syntax on java:S1125

Please provide

  • Operating system:Windows 10
  • IDE name and flavor/env: VS code
  • SonarLint plugin version:v3.4.1

I’m getting S1125 for a code smell:

MyVO vo;
public boolean is() {
    return vo == null ? false : vo.is();
}

Remove the unnecessary boolean literal.sonarlint(java:S1125)

But when choosing Quick Fix → SonarLint:Simplify the expression it return invalid java syntax:

return !vo == null && vo.is();

Hello @orimarko

The quick fix suggested is indeed not correct. Ticket created to improve the situation: SONARJAVA-4241.

Thanks for reporting this issue.
Best,
Quentin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.