Apparently dead code in LoggerFactory
TWiStErRob opened this issue · 3 comments
While reading slf4j2 code to figure out how bindingsproviders work, I came across a line that confused me: catch(NoSuchFieldError)
in LoggerFactory
slf4j/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
Lines 364 to 388 in 216459e
I was wondering why the comment references REQUESTED_API_VERSION
, while there's no such thing in the try
.
I found the change that invalidated that catch
, and I'm still baffled as to why Java does not complain about a checked exception being not used I see why javac didn't alert: it's an Error
, not checked!.
Hi @TWiStErRob
I think the NoSuchFieldError can no longer occur and it makes no sense to check for it. As for the compiler not complaining, it is a good question but beyond the scope of SLF4J.
See edit: Error
is not a checked exception.