From 70fb01cccfde5211ad590a9ca25f76a65392f0d9 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 7 Mar 2022 09:49:42 +0100 Subject: [PATCH] added jetbrains annotations --- pom.xml | 9 +++++++++ src/main/java/module-info.java | 2 ++ .../integrations/autostart/AutoStartProvider.java | 3 +++ .../integrations/keychain/KeychainAccessProvider.java | 9 +++++++++ .../integrations/tray/TrayMenuController.java | 2 ++ 5 files changed, 25 insertions(+) diff --git a/pom.xml b/pom.xml index dc00bca..5d03a19 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,15 @@ + + + org.jetbrains + annotations + 23.0.0 + provided + + + diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 2ac9eaf..9d69841 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -6,6 +6,8 @@ module org.cryptomator.integrations.api { + requires static org.jetbrains.annotations; + exports org.cryptomator.integrations.autostart; exports org.cryptomator.integrations.keychain; exports org.cryptomator.integrations.tray; diff --git a/src/main/java/org/cryptomator/integrations/autostart/AutoStartProvider.java b/src/main/java/org/cryptomator/integrations/autostart/AutoStartProvider.java index 49f6e3a..3a71d20 100644 --- a/src/main/java/org/cryptomator/integrations/autostart/AutoStartProvider.java +++ b/src/main/java/org/cryptomator/integrations/autostart/AutoStartProvider.java @@ -1,6 +1,7 @@ package org.cryptomator.integrations.autostart; import org.cryptomator.integrations.common.IntegrationsLoader; +import org.jetbrains.annotations.Blocking; import java.util.Optional; @@ -16,8 +17,10 @@ static Optional get() { return IntegrationsLoader.load(AutoStartProvider.class); } + @Blocking void enable() throws ToggleAutoStartFailedException; + @Blocking void disable() throws ToggleAutoStartFailedException; boolean isEnabled(); diff --git a/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java b/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java index ef0cfae..8116316 100644 --- a/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java +++ b/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java @@ -1,6 +1,9 @@ package org.cryptomator.integrations.keychain; import org.cryptomator.integrations.common.IntegrationsLoader; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Blocking; +import org.jetbrains.annotations.Nls; import java.util.stream.Stream; @@ -24,6 +27,7 @@ static Stream get() { * * @return user-friendly name (must not be null or empty) */ + @Nls(capitalization = Nls.Capitalization.Title) String displayName(); /** @@ -35,6 +39,7 @@ static Stream get() { * @deprecated Please use {@link #storePassphrase(String, String, CharSequence)} instead */ @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "1.2.0") void storePassphrase(String key, CharSequence passphrase) throws KeychainAccessException; /** @@ -47,6 +52,7 @@ static Stream get() { * @param passphrase The secret to store in this keychain. * @throws KeychainAccessException If storing the password failed */ + @Blocking default void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException { storePassphrase(key, passphrase); } @@ -56,6 +62,7 @@ default void storePassphrase(String key, String displayName, CharSequence passph * @return The stored passphrase for the given key or null if no value for the given key could be found. * @throws KeychainAccessException If loading the password failed */ + @Blocking char[] loadPassphrase(String key) throws KeychainAccessException; /** @@ -75,6 +82,7 @@ default void storePassphrase(String key, String displayName, CharSequence passph * @deprecated Please use {@link #changePassphrase(String, String, CharSequence)} instead */ @Deprecated + @ApiStatus.ScheduledForRemoval(inVersion = "1.2.0") void changePassphrase(String key, CharSequence passphrase) throws KeychainAccessException; /** @@ -87,6 +95,7 @@ default void storePassphrase(String key, String displayName, CharSequence passph * @param passphrase The secret to be updated in this keychain. * @throws KeychainAccessException If changing the password failed */ + @Blocking default void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException { changePassphrase(key, passphrase); } diff --git a/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java b/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java index 48833af..fadb980 100644 --- a/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java +++ b/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java @@ -1,6 +1,7 @@ package org.cryptomator.integrations.tray; import org.cryptomator.integrations.common.IntegrationsLoader; +import org.jetbrains.annotations.ApiStatus; import java.io.IOException; import java.io.InputStream; @@ -12,6 +13,7 @@ * * @since 1.1.0 */ +@ApiStatus.Experimental public interface TrayMenuController { static Optional get() {