You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE on
assert started != null;
if (started == null) ...
which is obviously wrong as assertions may be on or off. And no, this is no misuse of assertions.(*)
In production, assert is off, everywhere else it's on, which works like additional testing. So there are two versions of the code to be analyzed at the same time. When the null check makes sense in either version, then it's not redundant.
(*) I'm using Preconditions where they're needed and asserts where the tests are either too expensive or too unimportant. In this case, I believe that started is always set, but if it isn't, I'm surprised, but willing to live with it (it's a logging-only variable in a concurrent code).
The text was updated successfully, but these errors were encountered:
I'm getting
RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
onwhich is obviously wrong as assertions may be on or off. And no, this is no misuse of assertions.(*)
In production,
assert
is off, everywhere else it's on, which works like additional testing. So there are two versions of the code to be analyzed at the same time. When the null check makes sense in either version, then it's not redundant.(*) I'm using
Preconditions
where they're needed andassert
s where the tests are either too expensive or too unimportant. In this case, I believe that started is always set, but if it isn't, I'm surprised, but willing to live with it (it's a logging-only variable in a concurrent code).The text was updated successfully, but these errors were encountered: