Couple fixes, remove runtime dependency on error prone annotations

This commit is contained in:
Vankka 2022-03-28 17:20:37 +03:00
parent 1f6cefebac
commit c6cbf2dfc3
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
4 changed files with 7 additions and 5 deletions

View File

@ -3,12 +3,13 @@ apply from: rootProject.file('buildscript/relocations.gradle')
dependencies { dependencies {
// Annotations // Annotations
compileOnlyApi 'org.jetbrains:annotations:22.0.0' compileOnlyApi 'org.jetbrains:annotations:22.0.0'
api 'com.google.code.findbugs:jsr305:3.0.2' compileOnlyApi 'com.google.code.findbugs:jsr305:3.0.2'
// JDA // JDA
api('net.dv8tion:JDA:' + rootProject.jdaVersion) { api('net.dv8tion:JDA:' + rootProject.jdaVersion) {
// Annotations are suppose to be compile time only // Annotations are suppose to be compile time only
exclude group: 'org.jetbrains', module: 'annotations' exclude group: 'org.jetbrains', module: 'annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
// We don't use audio // We don't use audio
exclude module: 'opus-java' exclude module: 'opus-java'

View File

@ -43,7 +43,9 @@ dependencies {
runtimeDownloadApi 'commons-io:commons-io:2.10.0' runtimeDownloadApi 'commons-io:commons-io:2.10.0'
// Caffeine // Caffeine
runtimeDownloadApi 'com.github.ben-manes.caffeine:caffeine:2.9.2' runtimeDownloadApi('com.github.ben-manes.caffeine:caffeine:2.9.2') {
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
}
// Config // Config
runtimeDownloadApi 'org.spongepowered:configurate-yaml:' + rootProject.configurateVersion runtimeDownloadApi 'org.spongepowered:configurate-yaml:' + rootProject.configurateVersion

View File

@ -47,7 +47,6 @@ import com.discordsrv.common.exception.StorageException;
import com.discordsrv.common.function.CheckedFunction; import com.discordsrv.common.function.CheckedFunction;
import com.discordsrv.common.function.CheckedRunnable; import com.discordsrv.common.function.CheckedRunnable;
import com.discordsrv.common.groupsync.GroupSyncModule; import com.discordsrv.common.groupsync.GroupSyncModule;
import com.discordsrv.common.integration.LuckPermsIntegration;
import com.discordsrv.common.invite.DiscordInviteModule; import com.discordsrv.common.invite.DiscordInviteModule;
import com.discordsrv.common.linking.LinkProvider; import com.discordsrv.common.linking.LinkProvider;
import com.discordsrv.common.linking.impl.MemoryLinker; import com.discordsrv.common.linking.impl.MemoryLinker;
@ -453,7 +452,6 @@ public abstract class AbstractDiscordSRV<C extends MainConfig, CC extends Connec
registerModule(GlobalChannelLookupModule::new); registerModule(GlobalChannelLookupModule::new);
registerModule(DiscordAPIEventModule::new); registerModule(DiscordAPIEventModule::new);
registerModule(GroupSyncModule::new); registerModule(GroupSyncModule::new);
registerModule(LuckPermsIntegration::new);
registerModule(DiscordChatMessageModule::new); registerModule(DiscordChatMessageModule::new);
registerModule(DiscordMessageMirroringModule::new); registerModule(DiscordMessageMirroringModule::new);
registerModule(JoinMessageModule::new); registerModule(JoinMessageModule::new);

View File

@ -35,11 +35,12 @@ public final class ApiInstanceUtil {
public static void setInstance(@NotNull DiscordSRV discordSRV) { public static void setInstance(@NotNull DiscordSRV discordSRV) {
// Avoids illegal access // Avoids illegal access
try { try {
Class<?> apiProviderClass = Class.forName("com.discordsrv.api.InstanceHolder"); Class<?> apiProviderClass = Class.forName("com.discordsrv.api.ApiInstanceHolder");
Method provideMethod = apiProviderClass.getDeclaredMethod("provide", DiscordSRVApi.class); Method provideMethod = apiProviderClass.getDeclaredMethod("provide", DiscordSRVApi.class);
provideMethod.setAccessible(true); provideMethod.setAccessible(true);
provideMethod.invoke(null, discordSRV); provideMethod.invoke(null, discordSRV);
} catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { } catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
discordSRV.logger().error("Failed to set API instance", e); discordSRV.logger().error("Failed to set API instance", e);
} }
} }