Open tanmaysharma2001 opened 7 months ago
@yegor256 Can you review and merge this PR?
@tanmaysharma2001 what is the point of this modification?
@yegor256 In the issue #554, as we discussed that in cases where this.overwrite is null, attempting to evaluate it in a boolean context (if (this.overwrite)) will throw a NullPointerException, which can lead to unexpected crashes or behavior.
Having a primitive Boolean Expression, properly evaluates it, in case where it is null, it will be treated in the 'else' condition making it much safer against these exceptions.
@yegor256 In the issue #554, as we discussed that in cases where this.overwrite is null, attempting to evaluate it in a boolean context (if (this.overwrite)) will throw a NullPointerException, which can lead to unexpected crashes or behavior.
Having a primitive Boolean Expression, properly evaluates it, in case where it is null, it will be treated in the 'else' condition making it much safer against these exceptions.
@tanmaysharma2001
The main problem in the issue is not throwing NPE in the if statement, but that the field overwrite
is nullable
Yegor suggest there to fix the bug by making the field into primitive type
Also using static variables is the heresy in the Elegant Object ideology
@tanmaysharma2001 before making a fix, we must introduce a unit test, which will reproduce the error
Closes #554