diff --git a/application/src/main/java/org/togetherjava/tjbot/Application.java b/application/src/main/java/org/togetherjava/tjbot/Application.java index 4dc8ec128b..73b0b6be1a 100644 --- a/application/src/main/java/org/togetherjava/tjbot/Application.java +++ b/application/src/main/java/org/togetherjava/tjbot/Application.java @@ -27,8 +27,10 @@ * New commands can be created by implementing {@link SlashCommandInteractionEvent} or extending * {@link SlashCommandAdapter}. They can then be registered in {@link Features}. */ -public enum Application { - ; +public class Application { + private Application() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } private static final Logger logger = LoggerFactory.getLogger(Application.class); private static final String DEFAULT_CONFIG_PATH = "config.json"; diff --git a/application/src/main/java/org/togetherjava/tjbot/BootstrapLauncher.java b/application/src/main/java/org/togetherjava/tjbot/BootstrapLauncher.java index 0be2bb353a..bd264ca51e 100644 --- a/application/src/main/java/org/togetherjava/tjbot/BootstrapLauncher.java +++ b/application/src/main/java/org/togetherjava/tjbot/BootstrapLauncher.java @@ -4,8 +4,10 @@ * A bootstrap launcher with minimal dependencies that sets up needed parts and workarounds for the * main logic to take over. */ -public enum BootstrapLauncher { - ; +public class BootstrapLauncher { + private BootstrapLauncher() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } /** * Starts the main application. diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/Features.java b/application/src/main/java/org/togetherjava/tjbot/commands/Features.java index 81657ce752..83914e83ee 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/Features.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/Features.java @@ -39,8 +39,10 @@ * To add a new slash command, extend the commands returned by * {@link #createFeatures(JDA, Database, Config)}. */ -public enum Features { - ; +public class Features { + private Features() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } /** * Creates all features that should be registered with this application. diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/mathcommands/wolframalpha/WolframAlphaImages.java b/application/src/main/java/org/togetherjava/tjbot/commands/mathcommands/wolframalpha/WolframAlphaImages.java index 00c319ec6f..47a3a9306e 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/mathcommands/wolframalpha/WolframAlphaImages.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/mathcommands/wolframalpha/WolframAlphaImages.java @@ -25,8 +25,7 @@ * Utility class to work with images returned by the Wolfram Alpha API. For example to render and * combine them. */ -enum WolframAlphaImages { - ; +class WolframAlphaImages { static final String IMAGE_FORMAT = "png"; private static final Color IMAGE_BACKGROUND = Color.WHITE; private static final int IMAGE_MARGIN_PX = 10; @@ -35,7 +34,10 @@ enum WolframAlphaImages { new FontRenderContext(new AffineTransform(), true, true); private static final Color TITLE_COLOR = Color.decode("#3C3C3C"); private static final Font TITLE_FONT = new Font("Arial", Font.BOLD, 15); - private static final int TITLE_HEIGHT_PX = 20; + + private WolframAlphaImages() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } static @NotNull BufferedImage renderTitle(@NotNull String title) { Rectangle2D titleBounds = TITLE_FONT.getStringBounds(title, TITLE_RENDER_CONTEXT); diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/moderation/ModerationUtils.java b/application/src/main/java/org/togetherjava/tjbot/commands/moderation/ModerationUtils.java index 48119596d4..edf554d80c 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/moderation/ModerationUtils.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/moderation/ModerationUtils.java @@ -21,8 +21,10 @@ /** * Utility class offering helpers revolving around user moderation, such as banning or kicking. */ -public enum ModerationUtils { - ; +public class ModerationUtils { + private ModerationUtils() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } private static final Logger logger = LoggerFactory.getLogger(ModerationUtils.class); /** diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/utils/Hashing.java b/application/src/main/java/org/togetherjava/tjbot/commands/utils/Hashing.java index c82ed92bfe..b019c13864 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/utils/Hashing.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/utils/Hashing.java @@ -10,8 +10,10 @@ /** * Utility for hashing data. */ -public enum Hashing { - ; +public class Hashing { + private Hashing() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } /** * All characters available in the hexadecimal-system, as UTF-8 encoded array. diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/utils/MessageUtils.java b/application/src/main/java/org/togetherjava/tjbot/commands/utils/MessageUtils.java index 9ef485e9f2..380b2a50b6 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/utils/MessageUtils.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/utils/MessageUtils.java @@ -14,8 +14,10 @@ * This class is meant to contain all utility methods for {@link Message} that can be used on all * other commands to avoid similar methods appearing everywhere. */ -public enum MessageUtils { - ; +public class MessageUtils { + private MessageUtils() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } /** * Disables all the buttons that a message has. Disabling buttons deems it as not clickable to diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/utils/StringDistances.java b/application/src/main/java/org/togetherjava/tjbot/commands/utils/StringDistances.java index 27adb8457d..79b817d476 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/utils/StringDistances.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/utils/StringDistances.java @@ -11,8 +11,10 @@ /** * Utility class for computing string distances, for example the edit distance between two words. */ -public enum StringDistances { - ; +public class StringDistances { + private StringDistances() { + throw new UnsupportedOperationException("Utility class, construction not supported"); + } /** * Computes the candidate that matches the given query string best.