Open samho2008 opened 2 years ago
Historical reasons I guess, the message of the commit that added theses lines:
Rewritten @Cleanup's new null analysis prevention to not use
Lombok.preventNullAnalysis but go with Collections.singletonList(expr).get(0)
instead; while this does create a pointless object, it doesn't cause a clash
when eclipse has lombok 0.10 installed but the project uses 0.9, which doesn't
have preventNullAnalysis. Eventually, once 0.9 is long forgotten, this can be reverted.
I think @Cleanup
is a great feature and must not be abandoned, but improved!
The bad thing is: if a "close" method throws an exception, it completely replaces the original exception from the body.
Better:
Swallow the exception from close
Event better
Java 7 Suppressed exceptions
Java Code:
Decompiled Class Code:
The question is why use a singletonList to judge null, instead of
fileReader != null
?