From 0e4772873ad58ac08f4f8e7cf10b2d56f82ab4b7 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sun, 26 Dec 2021 22:59:46 +0100 Subject: [PATCH] Make exceptions anonymous where they're not used --- .../kotlin/fr/username404/snowygui/config/ConfigScreen.kt | 2 +- .../kotlin/fr/username404/snowygui/config/Configuration.kt | 2 +- .../kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt | 4 ++-- .../kotlin/fr/username404/snowygui/gui/feature/DiscordRPC.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt b/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt index bcc1ce1..66738e4 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/ConfigScreen.kt @@ -121,4 +121,4 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) { ) } }.build() -} catch (e: ClassNotFoundException) { field } \ No newline at end of file +} catch (_: ClassNotFoundException) { field } \ No newline at end of file diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index d7163b2..a1ed85c 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -62,7 +62,7 @@ object Configuration { setReadable(true) } else try { 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.") } } diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt index dc0e389..9c1cfc1 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt @@ -41,10 +41,10 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { *Snowy.annotatedButtons.mapNotNull { try { it.getConstructor().newInstance() - } catch (e: NoSuchMethodException) { + } catch (_: NoSuchMethodException) { try { it.getDeclaredField("INSTANCE").get(null) - } catch (e: NoSuchFieldException) {} + } catch (_: NoSuchFieldException) {} } as? ButtonImpl }.plus(Configuration.foundMacros).toTypedArray() ) diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/DiscordRPC.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/DiscordRPC.kt index 7b41d43..2ef6d1a 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/DiscordRPC.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/DiscordRPC.kt @@ -22,7 +22,7 @@ object DiscordRPC: ButtonImpl() { try { discord_rpc.discordInitialize("839058922102849538", RPCHandlers, true) 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.") isDisabled = true }