Make exceptions anonymous where they're not used
This commit is contained in:
parent
e90c9c1bb0
commit
0e4772873a
|
@ -121,4 +121,4 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.build()
|
}.build()
|
||||||
} catch (e: ClassNotFoundException) { field }
|
} catch (_: ClassNotFoundException) { field }
|
|
@ -62,7 +62,7 @@ object Configuration {
|
||||||
setReadable(true)
|
setReadable(true)
|
||||||
} else try {
|
} else try {
|
||||||
result = parseFile(file)
|
result = parseFile(file)
|
||||||
} catch (e: ConfigException) {
|
} catch (_: ConfigException) {
|
||||||
Snowy.logs.warn("Could not parse the snowy configuration file, the default configuration will be used instead.")
|
Snowy.logs.warn("Could not parse the snowy configuration file, the default configuration will be used instead.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,10 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
|
||||||
*Snowy.annotatedButtons.mapNotNull {
|
*Snowy.annotatedButtons.mapNotNull {
|
||||||
try {
|
try {
|
||||||
it.getConstructor().newInstance()
|
it.getConstructor().newInstance()
|
||||||
} catch (e: NoSuchMethodException) {
|
} catch (_: NoSuchMethodException) {
|
||||||
try {
|
try {
|
||||||
it.getDeclaredField("INSTANCE").get(null)
|
it.getDeclaredField("INSTANCE").get(null)
|
||||||
} catch (e: NoSuchFieldException) {}
|
} catch (_: NoSuchFieldException) {}
|
||||||
} as? ButtonImpl
|
} as? ButtonImpl
|
||||||
}.plus(Configuration.foundMacros).toTypedArray()
|
}.plus(Configuration.foundMacros).toTypedArray()
|
||||||
)
|
)
|
||||||
|
|
|
@ -22,7 +22,7 @@ object DiscordRPC: ButtonImpl() {
|
||||||
try {
|
try {
|
||||||
discord_rpc.discordInitialize("839058922102849538", RPCHandlers, true)
|
discord_rpc.discordInitialize("839058922102849538", RPCHandlers, true)
|
||||||
Runtime.getRuntime().addShutdownHook(Thread { discord_rpc.discordShutdown() })
|
Runtime.getRuntime().addShutdownHook(Thread { discord_rpc.discordShutdown() })
|
||||||
} catch (e: UnsatisfiedLinkError) {
|
} catch (_: UnsatisfiedLinkError) {
|
||||||
Snowy.logs.error("Could not initialize DiscordRPC because the needed libraries are not present on your operating system; the feature will therefore be disabled.")
|
Snowy.logs.error("Could not initialize DiscordRPC because the needed libraries are not present on your operating system; the feature will therefore be disabled.")
|
||||||
isDisabled = true
|
isDisabled = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue