Fixed Java warnings.

This commit is contained in:
sk89q 2010-12-29 23:15:53 -08:00
parent 687260801f
commit 912468f8a1
29 changed files with 57 additions and 46 deletions

View File

@ -483,8 +483,9 @@ public class CuboidClipboard {
* @return child tag * @return child tag
* @throws DataException * @throws DataException
*/ */
private static Tag getChildTag(Map<String,Tag> items, String key, Class expected) private static Tag getChildTag(Map<String,Tag> items, String key,
throws DataException { Class<? extends Tag> expected) throws DataException {
if (!items.containsKey(key)) { if (!items.containsKey(key)) {
throw new DataException("Schematic file is missing a \"" + key + "\" tag"); throw new DataException("Schematic file is missing a \"" + key + "\" tag");
} }

View File

@ -20,9 +20,7 @@
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.regions.*; import com.sk89q.worldedit.regions.*;
import com.sk89q.worldedit.blocks.*; import com.sk89q.worldedit.blocks.*;
import com.sk89q.worldedit.data.*;
import com.sk89q.worldedit.patterns.*; import com.sk89q.worldedit.patterns.*;
import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -80,10 +78,6 @@ public class EditSession {
* Random number generator. * Random number generator.
*/ */
private static Random prng = new Random(); private static Random prng = new Random();
/**
* Total number of blocks set over time.
*/
private int blockIndex = 0;
/** /**
* Construct the object with a maximum number of blocks. * Construct the object with a maximum number of blocks.
@ -228,9 +222,9 @@ public class EditSession {
// In the case of the queue, the block may have not actually been // In the case of the queue, the block may have not actually been
// changed yet // changed yet
if (queued) { if (queued) {
BlockVector blockPt = pt.toBlockVector(); /*BlockVector blockPt = pt.toBlockVector();
/*if (current.containsKey(blockPt)) { if (current.containsKey(blockPt)) {
return current.get(blockPt); return current.get(blockPt);
}*/ }*/
} }
@ -1088,10 +1082,6 @@ public class EditSession {
Vector newMin = min.add(shift); Vector newMin = min.add(shift);
Vector newMax = min.add(shift); Vector newMax = min.add(shift);
int xs = region.getWidth();
int ys = region.getHeight();
int zs = region.getLength();
Map<Vector,BaseBlock> delayed = new LinkedHashMap<Vector,BaseBlock>(); Map<Vector,BaseBlock> delayed = new LinkedHashMap<Vector,BaseBlock>();
@ -1737,8 +1727,6 @@ public class EditSession {
// Move up // Move up
basePos = basePos.add(0, trunkHeight, 0); basePos = basePos.add(0, trunkHeight, 0);
int pos2[] = {-2, 2};
// Create tree + leaves // Create tree + leaves
for (int i = 0; i < height; i++) { for (int i = 0; i < height; i++) {
setBlockIfAir(basePos.add(0, i, 0), logBlock); setBlockIfAir(basePos.add(0, i, 0), logBlock);
@ -1828,7 +1816,8 @@ public class EditSession {
public List<Countable<Integer>> getBlockDistribution(Region region) { public List<Countable<Integer>> getBlockDistribution(Region region) {
List<Countable<Integer>> distribution List<Countable<Integer>> distribution
= new ArrayList<Countable<Integer>>(); = new ArrayList<Countable<Integer>>();
Map<Integer,Countable> map = new HashMap<Integer,Countable>(); Map<Integer,Countable<Integer>> map =
new HashMap<Integer,Countable<Integer>>();
if (region instanceof CuboidRegion) { if (region instanceof CuboidRegion) {
// Doing this for speed // Doing this for speed

View File

@ -91,6 +91,7 @@ public class MinecraftServerInterface {
* @return * @return
* @throws Throwable * @throws Throwable
*/ */
@SuppressWarnings("rawtypes")
private static <T> T createNoConstructor(Class<T> clazz) throws Throwable { private static <T> T createNoConstructor(Class<T> clazz) throws Throwable {
try { try {
ReflectionFactory factory = ReflectionFactory.getReflectionFactory(); ReflectionFactory factory = ReflectionFactory.getReflectionFactory();

View File

@ -171,7 +171,7 @@ public class SnapshotRestore {
* *
* @return * @return
*/ */
public List getMissingChunks() { public List<Vector2D> getMissingChunks() {
return missingChunks; return missingChunks;
} }
@ -181,7 +181,7 @@ public class SnapshotRestore {
* *
* @return * @return
*/ */
public List getErrorChunks() { public List<Vector2D> getErrorChunks() {
return errorChunks; return errorChunks;
} }

View File

@ -19,10 +19,6 @@
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.jar.Manifest;
import java.util.jar.Attributes;
import java.net.URL;
import java.io.IOException;
/** /**
* Entry point for the plugin for hey0's mod. * Entry point for the plugin for hey0's mod.

View File

@ -41,7 +41,7 @@ public class WorldEditBridge {
* @throws NoSuchMethodException * @throws NoSuchMethodException
*/ */
private static Object invokeMethod(Object obj, String name, Object[] args, private static Object invokeMethod(Object obj, String name, Object[] args,
Class ... types) throws InvocationTargetException, IllegalAccessException, Class<?> ... types) throws InvocationTargetException, IllegalAccessException,
NoSuchMethodException { NoSuchMethodException {
Method method = obj.getClass().getDeclaredMethod(name, types); Method method = obj.getClass().getDeclaredMethod(name, types);
return method.invoke(obj, args); return method.invoke(obj, args);

View File

@ -1617,10 +1617,6 @@ public class WorldEditListener extends PluginListener {
public CuboidClipboard.FlipDirection getFlipDirection( public CuboidClipboard.FlipDirection getFlipDirection(
WorldEditPlayer player, String dir) WorldEditPlayer player, String dir)
throws UnknownDirectionException { throws UnknownDirectionException {
int xm = 0;
int ym = 0;
int zm = 0;
if (dir.equals("me")) { if (dir.equals("me")) {
dir = player.getCardinalDirection(); dir = player.getCardinalDirection();
} }
@ -1728,6 +1724,7 @@ public class WorldEditListener extends PluginListener {
* @return false if you want the action to go through * @return false if you want the action to go through
*/ */
@Override @Override
@SuppressWarnings("deprecation")
public boolean onBlockCreate(Player modPlayer, Block blockPlaced, public boolean onBlockCreate(Player modPlayer, Block blockPlaced,
Block blockClicked, int itemInHand) { Block blockClicked, int itemInHand) {
WorldEditPlayer player = new WorldEditPlayer(modPlayer); WorldEditPlayer player = new WorldEditPlayer(modPlayer);
@ -1898,9 +1895,6 @@ public class WorldEditListener extends PluginListener {
WorldEditSession.SuperPickaxeMode.SAME_TYPE_RECURSIVE) { WorldEditSession.SuperPickaxeMode.SAME_TYPE_RECURSIVE) {
Vector origin = new Vector(blockClicked.getX(), Vector origin = new Vector(blockClicked.getX(),
blockClicked.getY(), blockClicked.getZ()); blockClicked.getY(), blockClicked.getZ());
int ox = blockClicked.getX();
int oy = blockClicked.getY();
int oz = blockClicked.getZ();
int size = session.getSuperPickaxeRange(); int size = session.getSuperPickaxeRange();
int initialType = ServerInterface.getBlockType(origin); int initialType = ServerInterface.getBlockType(origin);

View File

@ -24,6 +24,8 @@ package com.sk89q.worldedit;
* @author sk89q * @author sk89q
*/ */
public class DisallowedItemException extends WorldEditException { public class DisallowedItemException extends WorldEditException {
private static final long serialVersionUID = -8080026411461549979L;
private String type; private String type;
public DisallowedItemException(String type) { public DisallowedItemException(String type) {

View File

@ -104,7 +104,9 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
* @param <A> * @param <A>
* @param <B> * @param <B>
*/ */
public class ForwardEntryIterator<T extends Map.Entry> implements Iterator<Map.Entry<A,B>> { public class ForwardEntryIterator<T extends Map.Entry<A,B>>
implements Iterator<Map.Entry<A,B>> {
private Iterator<A> keyIterator; private Iterator<A> keyIterator;
private Iterator<B> valueIterator; private Iterator<B> valueIterator;
@ -132,7 +134,9 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
* @param <A> * @param <A>
* @param <B> * @param <B>
*/ */
public class ReverseEntryIterator<T extends Map.Entry> implements Iterator<Map.Entry<A,B>> { public class ReverseEntryIterator<T extends Map.Entry<A,B>>
implements Iterator<Map.Entry<A,B>> {
private ListIterator<A> keyIterator; private ListIterator<A> keyIterator;
private ListIterator<B> valueIterator; private ListIterator<B> valueIterator;
@ -160,7 +164,7 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
* @param <A> * @param <A>
* @param <B> * @param <B>
*/ */
public class Entry<A,B> implements Map.Entry<A,B> { public class Entry<C,D> implements Map.Entry<A,B> {
private A key; private A key;
private B value; private B value;

View File

@ -24,5 +24,6 @@ package com.sk89q.worldedit;
* @author Albert * @author Albert
*/ */
public class EmptyClipboardException extends WorldEditException { public class EmptyClipboardException extends WorldEditException {
private static final long serialVersionUID = -3197424556127109425L;
} }

View File

@ -7,7 +7,6 @@ package com.sk89q.worldedit;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.io.*; import java.io.*;
@ -109,7 +108,7 @@ public class GroupRestrictionsManager {
int changeLimit = parts.length > 1 ? Integer.parseInt(parts[1]) : -1; int changeLimit = parts.length > 1 ? Integer.parseInt(parts[1]) : -1;
changeLimits.put(groupID, changeLimit); changeLimits.put(groupID, changeLimit);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
logger.log(Level.ALL.WARNING, "Integer expected in" logger.warning("Integer expected in"
+ "WorldEdit group permissions line: " + line); + "WorldEdit group permissions line: " + line);
} }
} }

View File

@ -22,8 +22,9 @@ package com.sk89q.worldedit;
/** /**
* Raised when a region is not fully defined. * Raised when a region is not fully defined.
* *
* @author Albert * @author sk89q
*/ */
public class IncompleteRegionException extends WorldEditException { public class IncompleteRegionException extends WorldEditException {
private static final long serialVersionUID = 458988897980179094L;
} }

View File

@ -24,6 +24,8 @@ package com.sk89q.worldedit;
* @author sk89q * @author sk89q
*/ */
public class InsufficientArgumentsException extends WorldEditException { public class InsufficientArgumentsException extends WorldEditException {
private static final long serialVersionUID = 995264804658899764L;
public InsufficientArgumentsException(String error) { public InsufficientArgumentsException(String error) {
super(error); super(error);
} }

View File

@ -24,6 +24,8 @@ package com.sk89q.worldedit;
* @author sk89q * @author sk89q
*/ */
public class InvalidItemException extends DisallowedItemException { public class InvalidItemException extends DisallowedItemException {
private static final long serialVersionUID = -2739618871154124586L;
public InvalidItemException(String type, String message) { public InvalidItemException(String type, String message) {
super(type, message); super(type, message);
} }

View File

@ -24,6 +24,8 @@ package com.sk89q.worldedit;
* @author sk89q * @author sk89q
*/ */
public class MaxChangedBlocksException extends WorldEditException { public class MaxChangedBlocksException extends WorldEditException {
private static final long serialVersionUID = -2621044030640945259L;
int maxBlocks; int maxBlocks;
public MaxChangedBlocksException(int maxBlocks) { public MaxChangedBlocksException(int maxBlocks) {

View File

@ -25,4 +25,5 @@ package com.sk89q.worldedit;
* @author sk89q * @author sk89q
*/ */
public class MaxRadiusException extends WorldEditException { public class MaxRadiusException extends WorldEditException {
private static final long serialVersionUID = -8405382841529528119L;
} }

View File

@ -24,6 +24,8 @@ package com.sk89q.worldedit;
* @author sk89q * @author sk89q
*/ */
public class UnknownDirectionException extends WorldEditException { public class UnknownDirectionException extends WorldEditException {
private static final long serialVersionUID = 5705931351293248358L;
private String dir; private String dir;
public UnknownDirectionException(String dir) { public UnknownDirectionException(String dir) {

View File

@ -25,6 +25,8 @@ package com.sk89q.worldedit;
* @author sk89q * @author sk89q
*/ */
public class UnknownItemException extends WorldEditException { public class UnknownItemException extends WorldEditException {
private static final long serialVersionUID = 2661079183700565880L;
private String type; private String type;
public UnknownItemException(String type) { public UnknownItemException(String type) {

View File

@ -21,9 +21,11 @@ package com.sk89q.worldedit;
/** /**
* *
* @author Albert * @author sk89q
*/ */
public abstract class WorldEditException extends Exception { public abstract class WorldEditException extends Exception {
private static final long serialVersionUID = 3201997990797993987L;
protected WorldEditException() { protected WorldEditException() {
} }

View File

@ -22,8 +22,9 @@ package com.sk89q.worldedit;
/** /**
* Raised when WorldEdit is not installed. * Raised when WorldEdit is not installed.
* *
* @author Albert * @author sk89q
*/ */
public class WorldEditNotInstalled extends WorldEditException { public class WorldEditNotInstalled extends WorldEditException {
private static final long serialVersionUID = -4698408698930848121L;
} }

View File

@ -19,12 +19,9 @@
package com.sk89q.worldedit.blocks; package com.sk89q.worldedit.blocks;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.data.*; import com.sk89q.worldedit.data.*;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import org.jnbt.*; import org.jnbt.*;
/** /**

View File

@ -236,7 +236,8 @@ public class Chunk {
* @return child tag * @return child tag
* @throws InvalidFormatException * @throws InvalidFormatException
*/ */
public static Tag getChildTag(Map<String,Tag> items, String key, Class expected) public static Tag getChildTag(Map<String,Tag> items, String key,
Class<? extends Tag> expected)
throws InvalidFormatException { throws InvalidFormatException {
if (!items.containsKey(key)) { if (!items.containsKey(key)) {
throw new InvalidFormatException("Missing a \"" + key + "\" tag"); throw new InvalidFormatException("Missing a \"" + key + "\" tag");

View File

@ -24,6 +24,8 @@ package com.sk89q.worldedit.data;
* @author sk89q * @author sk89q
*/ */
public class ChunkStoreException extends DataException { public class ChunkStoreException extends DataException {
private static final long serialVersionUID = 1483900743779953289L;
public ChunkStoreException(String msg) { public ChunkStoreException(String msg) {
super(msg); super(msg);
} }

View File

@ -25,6 +25,8 @@ package com.sk89q.worldedit.data;
* @author sk89q * @author sk89q
*/ */
public class DataException extends Exception { public class DataException extends Exception {
private static final long serialVersionUID = 5806521052111023788L;
public DataException(String msg) { public DataException(String msg) {
super(msg); super(msg);
} }

View File

@ -24,6 +24,8 @@ package com.sk89q.worldedit.data;
* @author sk89q * @author sk89q
*/ */
public class InvalidFormatException extends DataException { public class InvalidFormatException extends DataException {
private static final long serialVersionUID = -3401820540902726145L;
public InvalidFormatException(String msg) { public InvalidFormatException(String msg) {
super(msg); super(msg);
} }

View File

@ -26,6 +26,8 @@ import com.sk89q.worldedit.Vector2D;
* @author sk89q * @author sk89q
*/ */
public class MissingChunkException extends ChunkStoreException { public class MissingChunkException extends ChunkStoreException {
private static final long serialVersionUID = 8013715483709973489L;
private Vector2D pos; private Vector2D pos;
public MissingChunkException() { public MissingChunkException() {

View File

@ -22,7 +22,6 @@ package com.sk89q.worldedit.data;
import de.schlichtherle.io.*; import de.schlichtherle.io.*;
import de.schlichtherle.io.File; import de.schlichtherle.io.File;
import de.schlichtherle.io.FileInputStream; import de.schlichtherle.io.FileInputStream;
import de.schlichtherle.io.FileOutputStream;
import java.io.*; import java.io.*;
/** /**
@ -150,7 +149,7 @@ public class TrueZipAlphaChunkStore extends NestedFileChunkStore {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
try { try {
path.umount(); File.umount(new File(path));
} catch (ArchiveException e) { } catch (ArchiveException e) {
throw new IOException(e); throw new IOException(e);
} }

View File

@ -32,6 +32,7 @@ public class ZippedAlphaChunkStore extends NestedFileChunkStore {
/** /**
* ZIP file. * ZIP file.
*/ */
@SuppressWarnings("unused")
private File zipFile; private File zipFile;
/** /**
* Actual ZIP. * Actual ZIP.
@ -105,7 +106,9 @@ public class ZippedAlphaChunkStore extends NestedFileChunkStore {
// So not there either... // So not there either...
if (testEntry == null) { if (testEntry == null) {
for (Enumeration e = zip.entries(); e.hasMoreElements(); ) { for (Enumeration<? extends ZipEntry> e = zip.entries();
e.hasMoreElements(); ) {
testEntry = (ZipEntry)e.nextElement(); testEntry = (ZipEntry)e.nextElement();
// Whoo, found level.dat! // Whoo, found level.dat!

View File

@ -24,5 +24,6 @@ package com.sk89q.worldedit.snapshots;
* @author sk89q * @author sk89q
*/ */
public class InvalidSnapshotException extends Exception { public class InvalidSnapshotException extends Exception {
private static final long serialVersionUID = 7307139106494852893L;
} }