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

View File

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

View File

@ -5,6 +5,7 @@ import java.util.Map;
public class Events { public class Events {
public Map<String, Event<?>> events = new HashMap<String, Event<?>>(); public Map<String, Event<?>> events = new HashMap<String, Event<?>>();
@SuppressWarnings("unchecked")
public <T> void addListener(String eventName, Event.Listener<T> listener) { public <T> void addListener(String eventName, Event.Listener<T> listener) {
Event<?> genericEvent = events.get(eventName); Event<?> genericEvent = events.get(eventName);
Event<T> event = null; Event<T> event = null;
@ -16,6 +17,7 @@ public class Events {
event.addListener(listener); event.addListener(listener);
} }
@SuppressWarnings("unchecked")
public <T> void removeListener(String eventName, Event.Listener<T> listener) { public <T> void removeListener(String eventName, Event.Listener<T> listener) {
Event<?> genericEvent = events.get(eventName); Event<?> genericEvent = events.get(eventName);
Event<T> event = null; Event<T> event = null;
@ -25,6 +27,7 @@ public class Events {
} }
} }
@SuppressWarnings("unchecked")
public <T> void trigger(String eventName, T argument) { public <T> void trigger(String eventName, T argument) {
Event<?> genericEvent = events.get(eventName); Event<?> genericEvent = events.get(eventName);
if (genericEvent == null) 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. // 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) { public static void s(JSONObject o, String path, Object value) {
int index = path.indexOf('/'); int index = path.indexOf('/');
if (index == -1) { 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. // 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) { public static void a(JSONObject o, String path, Object value) {
Object oo = g(o, path); Object oo = g(o, path);
JSONArray array; JSONArray array;
@ -58,6 +60,7 @@ public class JSONUtils {
} }
// Simply creates a JSONArray. // Simply creates a JSONArray.
@SuppressWarnings("unchecked")
public static JSONArray l(Object... items) { public static JSONArray l(Object... items) {
JSONArray arr = new JSONArray(); JSONArray arr = new JSONArray();
for(Object item : items) { for(Object item : items) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,24 +5,14 @@ import java.util.Date;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; 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.ClientUpdateEvent;
import org.dynmap.DynmapPlugin; import org.dynmap.DynmapPlugin;
import org.dynmap.DynmapWorld; import org.dynmap.DynmapWorld;
import org.dynmap.MapManager;
import org.dynmap.PlayerList;
import org.dynmap.web.HttpField; import org.dynmap.web.HttpField;
import org.dynmap.web.HttpHandler; import org.dynmap.web.HttpHandler;
import org.dynmap.web.HttpRequest; import org.dynmap.web.HttpRequest;
import org.dynmap.web.HttpResponse; import org.dynmap.web.HttpResponse;
import org.dynmap.web.HttpStatus; import org.dynmap.web.HttpStatus;
import org.dynmap.web.Json;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import static org.dynmap.JSONUtils.*; 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.HttpRequest;
import org.dynmap.web.HttpResponse; import org.dynmap.web.HttpResponse;
import org.dynmap.web.HttpStatus; import org.dynmap.web.HttpStatus;
import org.dynmap.utils.FileLockManager;
public abstract class FileHandler implements HttpHandler { public abstract class FileHandler implements HttpHandler {
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");