Cleanup warnings

This commit is contained in:
Gabriele C 2016-04-01 17:02:57 +02:00
parent 46a10da40f
commit 997c31a03e
5 changed files with 8 additions and 7 deletions

View File

@ -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;

View File

@ -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));

View File

@ -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);
}

View File

@ -13,7 +13,7 @@ import java.util.Comparator;
* property, then "DataSource" properties will come before the "security" ones.</li>
* </ul>
*/
final class PropertyMapComparator implements Comparator<Property> {
final class PropertyMapComparator implements Comparator<Property<?>> {
private Node parent = Node.createRoot();
@ -22,12 +22,12 @@ final class PropertyMapComparator implements Comparator<Property> {
*
* @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());
}

View File

@ -167,6 +167,7 @@ public class AntiBotTest {
antiBot.checkAntiBot(player);
// then
@SuppressWarnings("unchecked")
List<String> playerList = (List<String>) 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());