diff --git a/router/java/src/net/i2p/data/router/RouterInfo.java b/router/java/src/net/i2p/data/router/RouterInfo.java index 24667108e8..0d60c6dc03 100644 --- a/router/java/src/net/i2p/data/router/RouterInfo.java +++ b/router/java/src/net/i2p/data/router/RouterInfo.java @@ -339,7 +339,7 @@ public class RouterInfo extends DatabaseEntry { // WARNING this sort algorithm cannot be changed, as it must be consistent // network-wide. The signature is not checked at readin time, but only // later, and the hashes are stored in a Set, not a List. - peers = (Collection) SortHelper.sortStructures(peers); + peers = SortHelper.sortStructures(peers); for (Hash peerHash : peers) { peerHash.writeBytes(out); } diff --git a/router/java/src/net/i2p/data/router/SortHelper.java b/router/java/src/net/i2p/data/router/SortHelper.java index 0c40fa3eda..c7cea3c6f4 100644 --- a/router/java/src/net/i2p/data/router/SortHelper.java +++ b/router/java/src/net/i2p/data/router/SortHelper.java @@ -31,12 +31,11 @@ class SortHelper { * WARNING - this sort order must be consistent network-wide, so while the order is arbitrary, * it cannot be changed. * Why? Just because it has to be consistent so signing will work. - * How to spec as returning the same type as the param? * DEPRECATED - Only used by RouterInfo. * * @return a new list */ - public static List sortStructures(Collection dataStructures) { + public static List sortStructures(Collection dataStructures) { if (dataStructures == null) return Collections.emptyList(); // This used to use Hash.toString(), which is insane, since a change to toString() @@ -52,7 +51,7 @@ class SortHelper { //for (DataStructure struct : tm.values()) { // rv.add(struct); //} - ArrayList rv = new ArrayList(dataStructures); + ArrayList rv = new ArrayList(dataStructures); sortStructureList(rv); return rv; } diff --git a/router/java/src/net/i2p/router/CommSystemFacade.java b/router/java/src/net/i2p/router/CommSystemFacade.java index e9c050762f..2b96255b96 100644 --- a/router/java/src/net/i2p/router/CommSystemFacade.java +++ b/router/java/src/net/i2p/router/CommSystemFacade.java @@ -48,7 +48,7 @@ public abstract class CommSystemFacade implements Service { public boolean haveInboundCapacity(int pct) { return true; } public boolean haveOutboundCapacity(int pct) { return true; } public boolean haveHighOutboundCapacity() { return true; } - public List getMostRecentErrorMessages() { return Collections.emptyList(); } + public List getMostRecentErrorMessages() { return Collections.emptyList(); } /** * Median clock skew of connected peers in seconds, or null if we cannot answer. diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index 0bad3ecedd..260115d454 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -611,6 +611,7 @@ public class Router implements RouterClock.ClockShiftListener { * This is synchronized with saveConfig(). * Not for external use. */ + @SuppressWarnings({ "unchecked", "rawtypes" }) public void readConfig() { synchronized(_configFileLock) { String f = getConfigFilename(); @@ -1391,6 +1392,7 @@ public class Router implements RouterClock.ClockShiftListener { * @return success * @since 0.8.13 */ + @SuppressWarnings({ "unchecked", "rawtypes" }) public boolean saveConfig(Map toAdd, Collection toRemove) { synchronized(_configFileLock) { if (toAdd != null) diff --git a/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java b/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java index 3fbfc381f0..05969ec03a 100644 --- a/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java +++ b/router/java/src/net/i2p/router/startup/LoadClientAppsJob.java @@ -207,7 +207,7 @@ public class LoadClientAppsJob extends JobImpl { if (args == null) args = new String[0]; Class cls = Class.forName(className, true, cl); - Method method = cls.getMethod("main", new Class[] { String[].class }); + Method method = cls.getMethod("main", String[].class); method.invoke(cls, new Object[] { args }); } @@ -287,7 +287,7 @@ public class LoadClientAppsJob extends JobImpl { ClientApp app = (ClientApp) con.newInstance(conArgs); mgr.addAndStart(app, _args); } else { - Method method = cls.getMethod("main", new Class[] { String[].class }); + Method method = cls.getMethod("main", String[].class); method.invoke(cls, new Object[] { _args }); } } catch (Throwable t) { diff --git a/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java b/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java index 012107e6c9..7c8e1b37dd 100644 --- a/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java +++ b/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java @@ -96,6 +96,7 @@ public class OutboundMessageRegistry { * @return non-null List of OutNetMessage describing messages that were waiting for * the payload */ + @SuppressWarnings("unchecked") public List getOriginalMessages(I2NPMessage message) { List matchedSelectors = null; List removedSelectors = null; @@ -193,6 +194,7 @@ public class OutboundMessageRegistry { /** * @param allowEmpty is msg.getMessage() allowed to be null? */ + @SuppressWarnings("unchecked") private void registerPending(OutNetMessage msg, boolean allowEmpty) { if ( (!allowEmpty) && (msg.getMessage() == null) ) throw new IllegalArgumentException("OutNetMessage doesn't contain an I2NPMessage? Impossible?"); @@ -229,6 +231,7 @@ public class OutboundMessageRegistry { /** * @param msg may be be null */ + @SuppressWarnings("unchecked") public void unregisterPending(OutNetMessage msg) { if (msg == null) return; MessageSelector sel = msg.getReplySelector(); @@ -262,6 +265,7 @@ public class OutboundMessageRegistry { _nextExpire = -1; } + @SuppressWarnings("unchecked") public void timeReached() { long now = _context.clock().now(); List removing = new ArrayList(8); diff --git a/router/java/src/net/i2p/router/transport/udp/TimedWeightedPriorityMessageQueue.java b/router/java/src/net/i2p/router/transport/udp/TimedWeightedPriorityMessageQueue.java index 193c1751fb..c6dbdb8e22 100644 --- a/router/java/src/net/i2p/router/transport/udp/TimedWeightedPriorityMessageQueue.java +++ b/router/java/src/net/i2p/router/transport/udp/TimedWeightedPriorityMessageQueue.java @@ -57,6 +57,7 @@ class TimedWeightedPriorityMessageQueue implements MessageQueue, OutboundMessage * specifically, this means how many messages in this queue * should be pulled off in a row before moving on to the next. */ + @SuppressWarnings({ "unchecked", "rawtypes" }) public TimedWeightedPriorityMessageQueue(RouterContext ctx, int[] priorityLimits, int[] weighting, FailedListener lsnr) { _context = ctx; _log = ctx.logManager().getLog(TimedWeightedPriorityMessageQueue.class); diff --git a/router/java/src/net/i2p/router/tunnel/PumpedTunnelGateway.java b/router/java/src/net/i2p/router/tunnel/PumpedTunnelGateway.java index 614c7faab9..4f1f82d87d 100644 --- a/router/java/src/net/i2p/router/tunnel/PumpedTunnelGateway.java +++ b/router/java/src/net/i2p/router/tunnel/PumpedTunnelGateway.java @@ -58,6 +58,7 @@ class PumpedTunnelGateway extends TunnelGateway { * @param receiver this receives the encrypted message and forwards it off * to the first hop */ + @SuppressWarnings({ "unchecked", "rawtypes" }) public PumpedTunnelGateway(RouterContext context, QueuePreprocessor preprocessor, Sender sender, Receiver receiver, TunnelGatewayPumper pumper) { super(context, preprocessor, sender, receiver);