You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error when using logger delegate in top-level function #65
When using the SLF4J delegate in a top-level function:
// file:Bootstrap.ktval log by SLF4Jfunmain() {
log.info("Starting...")
// ...
}
The code compiles but causes a runtime error:
Exception in thread "main" java.lang.NullPointerException
at dev.minn.jda.ktx.util.SLF4J.getValue(proxies.kt:63)
at codes.tis.minecord.BootstrapKt.getLog(Bootstrap.kt:10)
at codes.tis.minecord.BootstrapKt.main$lambda$0(Bootstrap.kt:13)
To prevent this, you can change thisRef: Any? to thisRef: Any which will cause a compile error when used in a top-level function. Users can instead use val log by SLF4J("name") or val log by SLF4J<Class>.
Activity