From 997c31a03ecd3aa75913af6a19f167f5819a4313 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 1 Apr 2016 17:02:57 +0200 Subject: [PATCH] Cleanup warnings --- .../xephi/authme/listener/AuthMeTablistPacketAdapter.java | 1 - .../authme/settings/properties/SettingsFieldRetriever.java | 4 ++-- .../fr/xephi/authme/settings/propertymap/PropertyMap.java | 2 +- .../authme/settings/propertymap/PropertyMapComparator.java | 6 +++--- src/test/java/fr/xephi/authme/AntiBotTest.java | 2 ++ 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeTablistPacketAdapter.java b/src/main/java/fr/xephi/authme/listener/AuthMeTablistPacketAdapter.java index bd32d1b8..ef4d0b93 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeTablistPacketAdapter.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeTablistPacketAdapter.java @@ -1,7 +1,6 @@ package fr.xephi.authme.listener; import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.ListenerPriority; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketEvent; diff --git a/src/main/java/fr/xephi/authme/settings/properties/SettingsFieldRetriever.java b/src/main/java/fr/xephi/authme/settings/properties/SettingsFieldRetriever.java index b4adfa07..ac8d65d9 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/SettingsFieldRetriever.java +++ b/src/main/java/fr/xephi/authme/settings/properties/SettingsFieldRetriever.java @@ -38,7 +38,7 @@ public final class SettingsFieldRetriever { for (Class clazz : CONFIGURATION_CLASSES) { Field[] declaredFields = clazz.getDeclaredFields(); for (Field field : declaredFields) { - Property property = getPropertyField(field); + Property property = getPropertyField(field); if (property != null) { properties.put(property, getCommentsForField(field)); } @@ -64,7 +64,7 @@ public final class SettingsFieldRetriever { field.setAccessible(true); if (field.isAccessible() && Property.class.equals(field.getType()) && Modifier.isStatic(field.getModifiers())) { try { - return (Property) field.get(null); + return (Property) field.get(null); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not fetch field '" + field.getName() + "' from class '" + field.getDeclaringClass().getSimpleName() + "': " + StringUtils.formatException(e)); diff --git a/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMap.java b/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMap.java index 9cac52d3..aed4ac0e 100644 --- a/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMap.java +++ b/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMap.java @@ -31,7 +31,7 @@ public class PropertyMap { * @param property The property to add * @param comments The comments associated to the property */ - public void put(Property property, String[] comments) { + public void put(Property property, String[] comments) { comparator.add(property); map.put(property, comments); } diff --git a/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java b/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java index a7ec1cb3..e6bd9fb4 100644 --- a/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java +++ b/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java @@ -13,7 +13,7 @@ import java.util.Comparator; * property, then "DataSource" properties will come before the "security" ones. * */ -final class PropertyMapComparator implements Comparator { +final class PropertyMapComparator implements Comparator> { private Node parent = Node.createRoot(); @@ -22,12 +22,12 @@ final class PropertyMapComparator implements Comparator { * * @param property The property that is being added */ - public void add(Property property) { + public void add(Property property) { parent.addNode(property.getPath()); } @Override - public int compare(Property p1, Property p2) { + public int compare(Property p1, Property p2) { return parent.compare(p1.getPath(), p2.getPath()); } diff --git a/src/test/java/fr/xephi/authme/AntiBotTest.java b/src/test/java/fr/xephi/authme/AntiBotTest.java index 4dace294..9950963a 100644 --- a/src/test/java/fr/xephi/authme/AntiBotTest.java +++ b/src/test/java/fr/xephi/authme/AntiBotTest.java @@ -167,6 +167,7 @@ public class AntiBotTest { antiBot.checkAntiBot(player); // then + @SuppressWarnings("unchecked") List playerList = (List) ReflectionTestUtils .getFieldValue(AntiBot.class, antiBot, "antibotPlayers"); assertThat(playerList, hasSize(1)); @@ -196,6 +197,7 @@ public class AntiBotTest { antiBot.checkAntiBot(player); // then + @SuppressWarnings("rawtypes") List playerList = (List) ReflectionTestUtils.getFieldValue(AntiBot.class, antiBot, "antibotPlayers"); assertThat(playerList, empty()); verify(bukkitService, never()).scheduleSyncDelayedTask(any(Runnable.class), anyLong());