This content has been marked as final. Show 4 replies
None of that code compiles. What was the real code? Maybe you never executed any of that code at all.
Of course, your right. Wrote the original code in the office and just wanted to explain the "obscurity" by pseudo code.
The original would not have been more explanatory, I think.....
(TYPE_1 and TYPE_2 were originally enums and SomeType a suitable class)
The point is that the check threw a NPE in the first case and worked in the second. You might reproduce this with arbitrary code. Will provide the Java-Version tomorrow....
Clearly it must have been 'person' that was null in the NPE case.
The point is that the check threw a NPE in the first case and worked in the second.