From 714a0c6664cd4091fd607b85fb2153d4a82cebee Mon Sep 17 00:00:00 2001 From: JaniruTEC Date: Fri, 25 Jun 2021 00:17:17 +0200 Subject: [PATCH] Removed unnecessary super interface See: https://github.com/cryptomator/cryptomator/pull/1691#discussion_r650770011 Also fixes: https://github.com/cryptomator/cryptomator/pull/1691#discussion_r650769229 --- .../settings/AbstractInvalidSetting.java | 23 ------------------- .../common/settings/InvalidSetting.java | 17 +++++++++++--- .../settings/InvalidSettingException.java | 14 +++++------ 3 files changed, 21 insertions(+), 33 deletions(-) delete mode 100644 src/main/java/org/cryptomator/common/settings/AbstractInvalidSetting.java diff --git a/src/main/java/org/cryptomator/common/settings/AbstractInvalidSetting.java b/src/main/java/org/cryptomator/common/settings/AbstractInvalidSetting.java deleted file mode 100644 index 5e08d69cb..000000000 --- a/src/main/java/org/cryptomator/common/settings/AbstractInvalidSetting.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.cryptomator.common.settings; - -import java.net.URI; - -public interface AbstractInvalidSetting { - - /** - * Returns the corresponding issue URI of this setting.
- * The issue URI usually resolves to a page on the - * Cryptomator Bugtracker. - * - * @return the issue URI or {@code null} if none is provided. - */ - URI getIssueURI(); - - /** - * Returns a (preferably localized) message, that helps the user understand the - * issue in their configuration and how to fix it. - * - * @return the non-null description of the issue. - */ - String getMessage(); -} \ No newline at end of file diff --git a/src/main/java/org/cryptomator/common/settings/InvalidSetting.java b/src/main/java/org/cryptomator/common/settings/InvalidSetting.java index 380aeb093..90595e9c2 100644 --- a/src/main/java/org/cryptomator/common/settings/InvalidSetting.java +++ b/src/main/java/org/cryptomator/common/settings/InvalidSetting.java @@ -4,7 +4,7 @@ import java.net.URI; import java.util.Objects; import java.util.ResourceBundle; -public enum InvalidSetting implements AbstractInvalidSetting { +public enum InvalidSetting { ; @@ -24,12 +24,23 @@ public enum InvalidSetting implements AbstractInvalidSetting { this(onDefaultTracker(issueId), Objects.requireNonNull(resourceKey)); } - @Override + /** + * Returns the corresponding issue URI of this setting.
+ * The issue URI usually resolves to a page on the + * Cryptomator Bugtracker. + * + * @return the issue URI or {@code null} if none is provided. + */ public URI getIssueURI() { return this.issue; } - @Override + /** + * Returns a (preferably localized) message, that helps the user understand the + * issue in their configuration and how to fix it. + * + * @return the non-null description of the issue. + */ public String getMessage() { if (!BUNDLE.containsKey(this.resourceKey)) { return UNKNOWN_KEY_FORMAT.formatted(this.resourceKey); diff --git a/src/main/java/org/cryptomator/common/settings/InvalidSettingException.java b/src/main/java/org/cryptomator/common/settings/InvalidSettingException.java index 63e2a598f..fe095a381 100644 --- a/src/main/java/org/cryptomator/common/settings/InvalidSettingException.java +++ b/src/main/java/org/cryptomator/common/settings/InvalidSettingException.java @@ -3,28 +3,28 @@ package org.cryptomator.common.settings; public class InvalidSettingException extends RuntimeException { - private final AbstractInvalidSetting reason; + private final InvalidSetting reason; private final String additionalMessage; - public InvalidSettingException(AbstractInvalidSetting reason) { + public InvalidSettingException(InvalidSetting reason) { this(reason, null, null); } - public InvalidSettingException(AbstractInvalidSetting reason, String additionalMessage) { + public InvalidSettingException(InvalidSetting reason, String additionalMessage) { this(reason, additionalMessage, null); } - public InvalidSettingException(AbstractInvalidSetting reason, Throwable cause) { + public InvalidSettingException(InvalidSetting reason, Throwable cause) { this(reason, null, cause); } - public InvalidSettingException(AbstractInvalidSetting reason, String additionalMessage, Throwable cause) { + public InvalidSettingException(InvalidSetting reason, String additionalMessage, Throwable cause) { super(composeMessage(reason, additionalMessage), cause); this.reason = reason; this.additionalMessage = additionalMessage; } - public AbstractInvalidSetting getReason() { + public InvalidSetting getReason() { return this.reason; } @@ -32,7 +32,7 @@ public class InvalidSettingException extends RuntimeException { return this.additionalMessage; } - private static String composeMessage(AbstractInvalidSetting reason, String additionalMessage) { + private static String composeMessage(InvalidSetting reason, String additionalMessage) { if (additionalMessage == null) { return reason.getMessage(); }