Just found a
if(value == null && value != null)
in Code that passed my review 🙈🙈🙈
@ConnyDuck lol, that's not even true for NaN haha
I'm curious what the unreachable code is...
I hope it's a joke of some sort. That would mean the person who wrote it knew what they were doing, rather than having a massive brain-fart.
@kd0bpv it happened during a Java -> Kotlin refactor where Optionals were removed. Previously it read
if(optional != null && !optional.isPresent())
@ConnyDuck maybe it is Schrodinger's value and null and not null at the same time.
@ConnyDuck Someone semi-recently found this in code that I wrote, which passed review by multiple people.
Fortunately, the condition was almost always true in normal circumstances, so the behavior was still as intended.
Unfortunately, the condition was almost always true in normal circumstances, so it took quite a while for the mistake to be found.
@ConnyDuck but... Idea inspections..
@charlag I simplified it, it was done with isNull extension functions and thats apparently not caught by inspections
@ConnyDuck You never know. The value of _value_ might change between those evaluations. ^^
Server run by the main developers of the project It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!