From 497846e5a6341fe313658d9c4d0ffb6fc3568ac3 Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 26 Mar 2020 17:01:55 +0000 Subject: [PATCH] Run some auto code inspections --- .../classloader/ReflectionClassLoader.java | 1 + .../file/watcher/AbstractFileWatcher.java | 2 +- .../lucko/luckperms/common/treeview/TreeNode.java | 13 ------------- .../sponge/service/proxy/api6/SubjectDataProxy.java | 3 +-- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/dependencies/classloader/ReflectionClassLoader.java b/common/src/main/java/me/lucko/luckperms/common/dependencies/classloader/ReflectionClassLoader.java index b7ea58a8c..e3b06b00e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/dependencies/classloader/ReflectionClassLoader.java +++ b/common/src/main/java/me/lucko/luckperms/common/dependencies/classloader/ReflectionClassLoader.java @@ -78,6 +78,7 @@ public class ReflectionClassLoader implements PluginClassLoader { } } + @SuppressWarnings("JavaReflectionMemberAccess") private static boolean isJava9OrNewer() { try { // method was added in the Java 9 release diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/watcher/AbstractFileWatcher.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/watcher/AbstractFileWatcher.java index 330b0e0e1..d8a29cc47 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/watcher/AbstractFileWatcher.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/watcher/AbstractFileWatcher.java @@ -70,7 +70,7 @@ public abstract class AbstractFileWatcher implements AutoCloseable { private final boolean autoRegisterNewSubDirectories; /** The thread currently being used to wait for & process watch events */ - private AtomicReference processingThread = new AtomicReference<>(); + private final AtomicReference processingThread = new AtomicReference<>(); public AbstractFileWatcher(FileSystem fileSystem, boolean autoRegisterNewSubDirectories) throws IOException { this.service = fileSystem.newWatchService(); diff --git a/common/src/main/java/me/lucko/luckperms/common/treeview/TreeNode.java b/common/src/main/java/me/lucko/luckperms/common/treeview/TreeNode.java index 4feba27af..5a9f869a7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/treeview/TreeNode.java +++ b/common/src/main/java/me/lucko/luckperms/common/treeview/TreeNode.java @@ -103,19 +103,6 @@ public class TreeNode { }); } - public TreeNode forceInsert(String s) { - Map childMap = getChildMap(); - return childMap.compute(s, (key, prev) -> { - if (prev != null) { - return prev; - } - - // dirty the cache & return a new node - this.cachedDeepSize = Integer.MIN_VALUE; - return new TreeNode(this); - }); - } - public Optional> getChildren() { return Optional.ofNullable(this.children); } diff --git a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java index 8ab169cf9..4451b0531 100644 --- a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java +++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java @@ -169,11 +169,10 @@ public final class SubjectDataProxy implements SubjectData, ProxiedServiceObject public boolean setOption(@NonNull Set contexts, @NonNull String key, String value) { if (value == null) { handle().thenCompose(handle -> handle.unsetOption(CompatibilityUtil.convertContexts(contexts), key)); - return true; } else { handle().thenCompose(handle -> handle.setOption(CompatibilityUtil.convertContexts(contexts), key, value)); - return true; } + return true; } @Override