Clean up warnings

This commit is contained in:
Mike Primm 2011-06-13 22:05:14 -05:00
parent 0cf7b4be9b
commit 2f22560f3d
14 changed files with 19 additions and 22 deletions

View File

@ -39,6 +39,7 @@ public class ClientComponent extends Component {
return o;
}
@SuppressWarnings("unchecked")
protected static final JSONArray convertList(List<?> l) {
JSONArray o = new JSONArray();
for(Object entry : l) {
@ -47,6 +48,7 @@ public class ClientComponent extends Component {
return o;
}
@SuppressWarnings("unchecked")
protected static final Object convert(Object o) {
if (o instanceof Map<?, ?>) {
return convertMap((Map<String, ?>)o);

View File

@ -29,6 +29,7 @@ public class ConfigurationNode implements Map<String, Object> {
entries = map;
}
@SuppressWarnings("unchecked")
public Object getObject(String path) {
if (path.isEmpty())
return entries;
@ -60,6 +61,7 @@ public class ConfigurationNode implements Map<String, Object> {
return o;
}
@SuppressWarnings("unchecked")
public <T> T getGeneric(String path, T def) {
Object o = getObject(path, def);
try {
@ -112,6 +114,7 @@ public class ConfigurationNode implements Map<String, Object> {
return o.toString();
}
@SuppressWarnings("unchecked")
public <T> List<T> getList(String path) {
try {
List<T> list = (List<T>)getObject(path, null);
@ -139,6 +142,7 @@ public class ConfigurationNode implements Map<String, Object> {
return new ConfigurationNode(v);
}
@SuppressWarnings("unchecked")
public List<ConfigurationNode> getNodes(String path) {
List<Object> o = getList(path);
@ -165,6 +169,7 @@ public class ConfigurationNode implements Map<String, Object> {
extendMap(this, other);
}
@SuppressWarnings("unchecked")
private final static void extendMap(Map<String, Object> left, Map<String, Object> right) {
ConfigurationNode original = new ConfigurationNode(left);
for(Map.Entry<String, Object> entry : right.entrySet()) {

View File

@ -5,6 +5,7 @@ import java.util.Map;
public class Events {
public Map<String, Event<?>> events = new HashMap<String, Event<?>>();
@SuppressWarnings("unchecked")
public <T> void addListener(String eventName, Event.Listener<T> listener) {
Event<?> genericEvent = events.get(eventName);
Event<T> event = null;
@ -16,6 +17,7 @@ public class Events {
event.addListener(listener);
}
@SuppressWarnings("unchecked")
public <T> void removeListener(String eventName, Event.Listener<T> listener) {
Event<?> genericEvent = events.get(eventName);
Event<T> event = null;
@ -25,6 +27,7 @@ public class Events {
}
}
@SuppressWarnings("unchecked")
public <T> void trigger(String eventName, T argument) {
Event<?> genericEvent = events.get(eventName);
if (genericEvent == null)

View File

@ -25,6 +25,7 @@ public class JSONUtils {
}
// Sets a value on the specified path. If JSONObjects inside the path are missing, they'll be created.
@SuppressWarnings("unchecked")
public static void s(JSONObject o, String path, Object value) {
int index = path.indexOf('/');
if (index == -1) {
@ -45,6 +46,7 @@ public class JSONUtils {
}
// Adds a value to the list at the specified path. If the list does not exist, it will be created.
@SuppressWarnings("unchecked")
public static void a(JSONObject o, String path, Object value) {
Object oo = g(o, path);
JSONArray array;
@ -58,6 +60,7 @@ public class JSONUtils {
}
// Simply creates a JSONArray.
@SuppressWarnings("unchecked")
public static JSONArray l(Object... items) {
JSONArray arr = new JSONArray();
for(Object item : items) {

View File

@ -102,6 +102,7 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent {
}
}
@SuppressWarnings("unchecked")
protected void writeUpdates() {
File outputFile;
File outputTempFile;

View File

@ -165,6 +165,7 @@ public class MapChunkCache {
if(!initialized) {
try {
@SuppressWarnings("rawtypes")
Class c = Class.forName("net.minecraft.server.Chunk");
getchunkdata = c.getDeclaredMethod("a", new Class[] { byte[].class, int.class,
int.class, int.class, int.class, int.class, int.class, int.class });
@ -177,6 +178,7 @@ public class MapChunkCache {
}
/* Get CraftWorld.popPreservedChunk(x,z) - reduces memory bloat from map traversals (optional) */
try {
@SuppressWarnings("rawtypes")
Class c = Class.forName("org.bukkit.craftbukkit.CraftWorld");
poppreservedchunk = c.getDeclaredMethod("popPreservedChunk", new Class[] { int.class, int.class });
} catch (ClassNotFoundException cnfx) {

View File

@ -3,10 +3,6 @@ package org.dynmap.flat;
import org.dynmap.DynmapWorld;
import static org.dynmap.JSONUtils.a;
import static org.dynmap.JSONUtils.s;
import java.awt.image.DataBufferInt;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.awt.image.ColorModel;
import java.io.File;
import java.io.IOException;

View File

@ -10,7 +10,6 @@ import org.bukkit.event.Event;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import java.lang.reflect.Field;
import org.dynmap.Client;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapPlugin;
@ -40,6 +39,7 @@ public class HeroChatHandler {
/* Reflection-based access wrapper for ChannelChatEvent from HeroChat */
private static class HeroChatChannelChatEvent {
@SuppressWarnings("rawtypes")
private static Class channelchatevent;
private static Method getsource;
private static Method getmessage;
@ -97,6 +97,7 @@ public class HeroChatHandler {
/* Reflection-based access wrapper for ChannelEvent from HeroChat */
private static class HeroChatChannelEvent {
@SuppressWarnings("rawtypes")
private static Class channelevent;
private static Method getchannel;
private static Method iscancelled;
@ -148,6 +149,7 @@ public class HeroChatHandler {
/* Reflection-based access wrapper for Channel from HeroChat */
private static class HeroChatChannel {
@SuppressWarnings("rawtypes")
private static Class channel;
private static Method getname;
private static Method getnick;

View File

@ -11,7 +11,6 @@ import java.util.List;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.World;
import org.dynmap.ConfigurationNode;
import org.dynmap.DynmapChunk;
import org.dynmap.Log;

View File

@ -2,8 +2,6 @@ package org.dynmap.kzedmap;
import org.dynmap.DynmapWorld;
import java.io.File;
import org.bukkit.World;
import org.dynmap.MapTile;
public class KzedMapTile extends MapTile {

View File

@ -1,7 +1,6 @@
package org.dynmap.kzedmap;
import org.dynmap.DynmapWorld;
import org.bukkit.World;
import org.dynmap.MapTile;
public class KzedZoomedMapTile extends MapTile {

View File

@ -2,8 +2,6 @@ package org.dynmap.web.handlers;
import java.io.BufferedOutputStream;
import java.util.Date;
import java.util.Map;
import org.dynmap.DynmapPlugin;
import org.dynmap.DynmapWorld;
import org.dynmap.Event;

View File

@ -5,24 +5,14 @@ import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.config.Configuration;
import org.dynmap.Client;
import org.dynmap.ClientUpdateEvent;
import org.dynmap.DynmapPlugin;
import org.dynmap.DynmapWorld;
import org.dynmap.MapManager;
import org.dynmap.PlayerList;
import org.dynmap.web.HttpField;
import org.dynmap.web.HttpHandler;
import org.dynmap.web.HttpRequest;
import org.dynmap.web.HttpResponse;
import org.dynmap.web.HttpStatus;
import org.dynmap.web.Json;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import static org.dynmap.JSONUtils.*;

View File

@ -13,7 +13,6 @@ import org.dynmap.web.HttpHandler;
import org.dynmap.web.HttpRequest;
import org.dynmap.web.HttpResponse;
import org.dynmap.web.HttpStatus;
import org.dynmap.utils.FileLockManager;
public abstract class FileHandler implements HttpHandler {
protected static final Logger log = Logger.getLogger("Minecraft");