Cleanup warnings
This commit is contained in:
parent
46a10da40f
commit
997c31a03e
@ -1,7 +1,6 @@
|
|||||||
package fr.xephi.authme.listener;
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public final class SettingsFieldRetriever {
|
|||||||
for (Class<?> clazz : CONFIGURATION_CLASSES) {
|
for (Class<?> clazz : CONFIGURATION_CLASSES) {
|
||||||
Field[] declaredFields = clazz.getDeclaredFields();
|
Field[] declaredFields = clazz.getDeclaredFields();
|
||||||
for (Field field : declaredFields) {
|
for (Field field : declaredFields) {
|
||||||
Property property = getPropertyField(field);
|
Property<?> property = getPropertyField(field);
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
properties.put(property, getCommentsForField(field));
|
properties.put(property, getCommentsForField(field));
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ public final class SettingsFieldRetriever {
|
|||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
if (field.isAccessible() && Property.class.equals(field.getType()) && Modifier.isStatic(field.getModifiers())) {
|
if (field.isAccessible() && Property.class.equals(field.getType()) && Modifier.isStatic(field.getModifiers())) {
|
||||||
try {
|
try {
|
||||||
return (Property) field.get(null);
|
return (Property<?>) field.get(null);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new IllegalStateException("Could not fetch field '" + field.getName() + "' from class '"
|
throw new IllegalStateException("Could not fetch field '" + field.getName() + "' from class '"
|
||||||
+ field.getDeclaringClass().getSimpleName() + "': " + StringUtils.formatException(e));
|
+ field.getDeclaringClass().getSimpleName() + "': " + StringUtils.formatException(e));
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class PropertyMap {
|
|||||||
* @param property The property to add
|
* @param property The property to add
|
||||||
* @param comments The comments associated to the property
|
* @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);
|
comparator.add(property);
|
||||||
map.put(property, comments);
|
map.put(property, comments);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import java.util.Comparator;
|
|||||||
* property, then "DataSource" properties will come before the "security" ones.</li>
|
* property, then "DataSource" properties will come before the "security" ones.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
final class PropertyMapComparator implements Comparator<Property> {
|
final class PropertyMapComparator implements Comparator<Property<?>> {
|
||||||
|
|
||||||
private Node parent = Node.createRoot();
|
private Node parent = Node.createRoot();
|
||||||
|
|
||||||
@ -22,12 +22,12 @@ final class PropertyMapComparator implements Comparator<Property> {
|
|||||||
*
|
*
|
||||||
* @param property The property that is being added
|
* @param property The property that is being added
|
||||||
*/
|
*/
|
||||||
public void add(Property property) {
|
public void add(Property<?> property) {
|
||||||
parent.addNode(property.getPath());
|
parent.addNode(property.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Property p1, Property p2) {
|
public int compare(Property<?> p1, Property<?> p2) {
|
||||||
return parent.compare(p1.getPath(), p2.getPath());
|
return parent.compare(p1.getPath(), p2.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -167,6 +167,7 @@ public class AntiBotTest {
|
|||||||
antiBot.checkAntiBot(player);
|
antiBot.checkAntiBot(player);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
List<String> playerList = (List<String>) ReflectionTestUtils
|
List<String> playerList = (List<String>) ReflectionTestUtils
|
||||||
.getFieldValue(AntiBot.class, antiBot, "antibotPlayers");
|
.getFieldValue(AntiBot.class, antiBot, "antibotPlayers");
|
||||||
assertThat(playerList, hasSize(1));
|
assertThat(playerList, hasSize(1));
|
||||||
@ -196,6 +197,7 @@ public class AntiBotTest {
|
|||||||
antiBot.checkAntiBot(player);
|
antiBot.checkAntiBot(player);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
List<?> playerList = (List) ReflectionTestUtils.getFieldValue(AntiBot.class, antiBot, "antibotPlayers");
|
List<?> playerList = (List) ReflectionTestUtils.getFieldValue(AntiBot.class, antiBot, "antibotPlayers");
|
||||||
assertThat(playerList, empty());
|
assertThat(playerList, empty());
|
||||||
verify(bukkitService, never()).scheduleSyncDelayedTask(any(Runnable.class), anyLong());
|
verify(bukkitService, never()).scheduleSyncDelayedTask(any(Runnable.class), anyLong());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user