Comment on Lombok Saved My AssparentComments−kitd6yIn the article, the if check occurs in a finally clause. So the code would execute even if the constructor threw an exception. Hence the need to null-check it first.−hombre_fatal6yBut that just isn't true. Neither finally-block appends a try-block that initializes the stream that it null-checks.If the `in` stream init throws, the entire try-block isn't run at all. If `out` stream init throws, the following try/finally block isn't run either.Lombok's docs get this wrong too. Unless I'm going crazy.
Comments
In the article, the if check occurs in a finally clause. So the code would execute even if the constructor threw an exception. Hence the need to null-check it first.
But that just isn't true. Neither finally-block appends a try-block that initializes the stream that it null-checks.
If the `in` stream init throws, the entire try-block isn't run at all. If `out` stream init throws, the following try/finally block isn't run either.
Lombok's docs get this wrong too. Unless I'm going crazy.