I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 4e6ddfce authored by zzz's avatar zzz
Browse files

lint core

parent 3411a7c8
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,7 @@ public class I2PAppContext { ...@@ -84,6 +84,7 @@ public class I2PAppContext {
private RandomSource _random; private RandomSource _random;
private KeyGenerator _keyGenerator; private KeyGenerator _keyGenerator;
protected KeyRing _keyRing; // overridden in RouterContext protected KeyRing _keyRing; // overridden in RouterContext
@SuppressWarnings("deprecation")
private SimpleScheduler _simpleScheduler; private SimpleScheduler _simpleScheduler;
private SimpleTimer _simpleTimer; private SimpleTimer _simpleTimer;
private SimpleTimer2 _simpleTimer2; private SimpleTimer2 _simpleTimer2;
...@@ -532,7 +533,7 @@ public class I2PAppContext { ...@@ -532,7 +533,7 @@ public class I2PAppContext {
* @return set of Strings containing the names of defined system properties * @return set of Strings containing the names of defined system properties
*/ */
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
public Set<String> getPropertyNames() { public Set<String> getPropertyNames() {
// clone to avoid ConcurrentModificationException // clone to avoid ConcurrentModificationException
Set<String> names = new HashSet<String>((Set<String>) (Set) ((Properties) System.getProperties().clone()).keySet()); // TODO-Java6: s/keySet()/stringPropertyNames()/ Set<String> names = new HashSet<String>((Set<String>) (Set) ((Properties) System.getProperties().clone()).keySet()); // TODO-Java6: s/keySet()/stringPropertyNames()/
if (_overrideProps != null) if (_overrideProps != null)
...@@ -940,6 +941,7 @@ public class I2PAppContext { ...@@ -940,6 +941,7 @@ public class I2PAppContext {
* @since 0.9 to replace static instance in the class * @since 0.9 to replace static instance in the class
* @deprecated in 0.9.20, use simpleTimer2() * @deprecated in 0.9.20, use simpleTimer2()
*/ */
@SuppressWarnings("deprecation")
public SimpleScheduler simpleScheduler() { public SimpleScheduler simpleScheduler() {
if (!_simpleSchedulerInitialized) if (!_simpleSchedulerInitialized)
initializeSimpleScheduler(); initializeSimpleScheduler();
......
...@@ -18,6 +18,7 @@ import net.i2p.data.Destination; ...@@ -18,6 +18,7 @@ import net.i2p.data.Destination;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.data.PrivateKey; import net.i2p.data.PrivateKey;
import net.i2p.data.SessionKey; import net.i2p.data.SessionKey;
import net.i2p.data.SessionTag;
import net.i2p.data.SigningPrivateKey; import net.i2p.data.SigningPrivateKey;
/** /**
...@@ -98,7 +99,7 @@ public interface I2PSession { ...@@ -98,7 +99,7 @@ public interface I2PSession {
* objects that were sent along side the given keyUsed. * objects that were sent along side the given keyUsed.
* @return success * @return success
*/ */
public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set tagsSent) throws I2PSessionException; public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set<SessionTag> tagsSent) throws I2PSessionException;
/** /**
* End-to-End Crypto is disabled, tags and keys are ignored. * End-to-End Crypto is disabled, tags and keys are ignored.
...@@ -106,7 +107,7 @@ public interface I2PSession { ...@@ -106,7 +107,7 @@ public interface I2PSession {
* @param tagsSent UNUSED, IGNORED. * @param tagsSent UNUSED, IGNORED.
* @return success * @return success
*/ */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent) throws I2PSessionException; public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent) throws I2PSessionException;
/** /**
* End-to-End Crypto is disabled, tags and keys are ignored. * End-to-End Crypto is disabled, tags and keys are ignored.
...@@ -116,7 +117,7 @@ public interface I2PSession { ...@@ -116,7 +117,7 @@ public interface I2PSession {
* @return success * @return success
* @since 0.7.1 * @since 0.7.1
*/ */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expire) throws I2PSessionException; public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expire) throws I2PSessionException;
/** /**
* See I2PSessionMuxedImpl for proto/port details. * See I2PSessionMuxedImpl for proto/port details.
...@@ -133,7 +134,7 @@ public interface I2PSession { ...@@ -133,7 +134,7 @@ public interface I2PSession {
* @return success * @return success
* @since 0.7.1 * @since 0.7.1
*/ */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent,
int proto, int fromPort, int toPort) throws I2PSessionException; int proto, int fromPort, int toPort) throws I2PSessionException;
/** /**
...@@ -152,7 +153,7 @@ public interface I2PSession { ...@@ -152,7 +153,7 @@ public interface I2PSession {
* @return success * @return success
* @since 0.7.1 * @since 0.7.1
*/ */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expire, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expire,
int proto, int fromPort, int toPort) throws I2PSessionException; int proto, int fromPort, int toPort) throws I2PSessionException;
/** /**
...@@ -171,7 +172,7 @@ public interface I2PSession { ...@@ -171,7 +172,7 @@ public interface I2PSession {
* @return success * @return success
* @since 0.8.4 * @since 0.8.4
*/ */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expire, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expire,
int proto, int fromPort, int toPort, int flags) throws I2PSessionException; int proto, int fromPort, int toPort, int flags) throws I2PSessionException;
/** /**
......
...@@ -132,7 +132,7 @@ class I2CPMessageProducer { ...@@ -132,7 +132,7 @@ class I2CPMessageProducer {
* @param newKey unused - no end-to-end crypto * @param newKey unused - no end-to-end crypto
*/ */
public void sendMessage(I2PSessionImpl session, Destination dest, long nonce, byte[] payload, SessionTag tag, public void sendMessage(I2PSessionImpl session, Destination dest, long nonce, byte[] payload, SessionTag tag,
SessionKey key, Set tags, SessionKey newKey, long expires) throws I2PSessionException { SessionKey key, Set<SessionTag> tags, SessionKey newKey, long expires) throws I2PSessionException {
sendMessage(session, dest, nonce, payload, expires, 0); sendMessage(session, dest, nonce, payload, expires, 0);
} }
......
...@@ -29,6 +29,7 @@ import net.i2p.client.SendMessageStatusListener; ...@@ -29,6 +29,7 @@ import net.i2p.client.SendMessageStatusListener;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.data.SessionKey; import net.i2p.data.SessionKey;
import net.i2p.data.SessionTag;
import net.i2p.data.i2cp.MessageId; import net.i2p.data.i2cp.MessageId;
import net.i2p.data.i2cp.MessageStatusMessage; import net.i2p.data.i2cp.MessageStatusMessage;
import net.i2p.util.Log; import net.i2p.util.Log;
...@@ -210,17 +211,17 @@ class I2PSessionImpl2 extends I2PSessionImpl { ...@@ -210,17 +211,17 @@ class I2PSessionImpl2 extends I2PSessionImpl {
throw new UnsupportedOperationException("Use MuxedImpl"); throw new UnsupportedOperationException("Use MuxedImpl");
} }
/** @throws UnsupportedOperationException always, use MuxedImpl */ /** @throws UnsupportedOperationException always, use MuxedImpl */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent,
int proto, int fromport, int toport) throws I2PSessionException { int proto, int fromport, int toport) throws I2PSessionException {
throw new UnsupportedOperationException("Use MuxedImpl"); throw new UnsupportedOperationException("Use MuxedImpl");
} }
/** @throws UnsupportedOperationException always, use MuxedImpl */ /** @throws UnsupportedOperationException always, use MuxedImpl */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expire, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expire,
int proto, int fromport, int toport) throws I2PSessionException { int proto, int fromport, int toport) throws I2PSessionException {
throw new UnsupportedOperationException("Use MuxedImpl"); throw new UnsupportedOperationException("Use MuxedImpl");
} }
/** @throws UnsupportedOperationException always, use MuxedImpl */ /** @throws UnsupportedOperationException always, use MuxedImpl */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expire, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expire,
int proto, int fromport, int toport, int flags) throws I2PSessionException { int proto, int fromport, int toport, int flags) throws I2PSessionException {
throw new UnsupportedOperationException("Use MuxedImpl"); throw new UnsupportedOperationException("Use MuxedImpl");
} }
...@@ -253,7 +254,7 @@ class I2PSessionImpl2 extends I2PSessionImpl { ...@@ -253,7 +254,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
* @param tagsSent unused - no end-to-end crypto * @param tagsSent unused - no end-to-end crypto
*/ */
@Override @Override
public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set tagsSent) throws I2PSessionException { public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set<SessionTag> tagsSent) throws I2PSessionException {
return sendMessage(dest, payload, 0, payload.length, keyUsed, tagsSent, 0); return sendMessage(dest, payload, 0, payload.length, keyUsed, tagsSent, 0);
} }
...@@ -261,7 +262,7 @@ class I2PSessionImpl2 extends I2PSessionImpl { ...@@ -261,7 +262,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
* @param keyUsed unused - no end-to-end crypto * @param keyUsed unused - no end-to-end crypto
* @param tagsSent unused - no end-to-end crypto * @param tagsSent unused - no end-to-end crypto
*/ */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent) public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent)
throws I2PSessionException { throws I2PSessionException {
return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0); return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0);
} }
...@@ -272,7 +273,7 @@ class I2PSessionImpl2 extends I2PSessionImpl { ...@@ -272,7 +273,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
* @param keyUsed unused - no end-to-end crypto * @param keyUsed unused - no end-to-end crypto
* @param tagsSent unused - no end-to-end crypto * @param tagsSent unused - no end-to-end crypto
*/ */
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expires) public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expires)
throws I2PSessionException { throws I2PSessionException {
if (_log.shouldLog(Log.DEBUG)) _log.debug("sending message"); if (_log.shouldLog(Log.DEBUG)) _log.debug("sending message");
synchronized (_stateLock) { synchronized (_stateLock) {
...@@ -339,7 +340,7 @@ class I2PSessionImpl2 extends I2PSessionImpl { ...@@ -339,7 +340,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
* @param keyUsed unused - no end-to-end crypto * @param keyUsed unused - no end-to-end crypto
* @param tagsSent unused - no end-to-end crypto * @param tagsSent unused - no end-to-end crypto
*/ */
protected boolean sendBestEffort(Destination dest, byte payload[], SessionKey keyUsed, Set tagsSent, long expires) protected boolean sendBestEffort(Destination dest, byte payload[], SessionKey keyUsed, Set<SessionTag> tagsSent, long expires)
throws I2PSessionException { throws I2PSessionException {
return sendBestEffort(dest, payload, expires, 0); return sendBestEffort(dest, payload, expires, 0);
} }
......
...@@ -19,6 +19,7 @@ import net.i2p.client.SendMessageStatusListener; ...@@ -19,6 +19,7 @@ import net.i2p.client.SendMessageStatusListener;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.data.SessionKey; import net.i2p.data.SessionKey;
import net.i2p.data.SessionTag;
import net.i2p.data.i2cp.MessagePayloadMessage; import net.i2p.data.i2cp.MessagePayloadMessage;
import net.i2p.util.Log; import net.i2p.util.Log;
...@@ -163,7 +164,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 { ...@@ -163,7 +164,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 {
*/ */
@Override @Override
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size,
SessionKey keyUsed, Set tagsSent, long expires) SessionKey keyUsed, Set<SessionTag> tagsSent, long expires)
throws I2PSessionException { throws I2PSessionException {
return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0, PROTO_UNSPECIFIED, PORT_UNSPECIFIED, PORT_UNSPECIFIED); return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0, PROTO_UNSPECIFIED, PORT_UNSPECIFIED, PORT_UNSPECIFIED);
} }
...@@ -173,7 +174,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 { ...@@ -173,7 +174,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 {
* @param tagsSent unused - no end-to-end crypto * @param tagsSent unused - no end-to-end crypto
*/ */
@Override @Override
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent,
int proto, int fromport, int toport) throws I2PSessionException { int proto, int fromport, int toport) throws I2PSessionException {
return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0, proto, fromport, toport); return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0, proto, fromport, toport);
} }
...@@ -192,7 +193,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 { ...@@ -192,7 +193,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 {
*/ */
@Override @Override
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size,
SessionKey keyUsed, Set tagsSent, long expires, SessionKey keyUsed, Set<SessionTag> tagsSent, long expires,
int proto, int fromPort, int toPort) int proto, int fromPort, int toPort)
throws I2PSessionException { throws I2PSessionException {
return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0, proto, fromPort, toPort, 0); return sendMessage(dest, payload, offset, size, keyUsed, tagsSent, 0, proto, fromPort, toPort, 0);
...@@ -213,7 +214,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 { ...@@ -213,7 +214,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 {
*/ */
@Override @Override
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, public boolean sendMessage(Destination dest, byte[] payload, int offset, int size,
SessionKey keyUsed, Set tagsSent, long expires, SessionKey keyUsed, Set<SessionTag> tagsSent, long expires,
int proto, int fromPort, int toPort, int flags) int proto, int fromPort, int toPort, int flags)
throws I2PSessionException { throws I2PSessionException {
payload = prepPayload(payload, offset, size, proto, fromPort, toPort); payload = prepPayload(payload, offset, size, proto, fromPort, toPort);
......
...@@ -536,7 +536,7 @@ public abstract class NamingService { ...@@ -536,7 +536,7 @@ public abstract class NamingService {
String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL); String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL);
try { try {
Class<?> cls = Class.forName(impl); Class<?> cls = Class.forName(impl);
Constructor<?> con = cls.getConstructor(new Class[] { I2PAppContext.class }); Constructor<?> con = cls.getConstructor(I2PAppContext.class);
instance = (NamingService)con.newInstance(new Object[] { context }); instance = (NamingService)con.newInstance(new Object[] { context });
} catch (Exception ex) { } catch (Exception ex) {
Log log = context.logManager().getLog(NamingService.class); Log log = context.logManager().getLog(NamingService.class);
......
...@@ -46,7 +46,6 @@ import net.i2p.util.SystemVersion; ...@@ -46,7 +46,6 @@ import net.i2p.util.SystemVersion;
public class SDSCache<V extends SimpleDataStructure> { public class SDSCache<V extends SimpleDataStructure> {
//private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(SDSCache.class); //private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(SDSCache.class);
private static final Class[] conArg = new Class[] { byte[].class };
private static final double MIN_FACTOR = 0.20; private static final double MIN_FACTOR = 0.20;
private static final double MAX_FACTOR = 5.0; private static final double MAX_FACTOR = 5.0;
private static final double FACTOR; private static final double FACTOR;
...@@ -74,7 +73,7 @@ public class SDSCache<V extends SimpleDataStructure> { ...@@ -74,7 +73,7 @@ public class SDSCache<V extends SimpleDataStructure> {
_cache = new LHMCache<Integer, WeakReference<V>>(size); _cache = new LHMCache<Integer, WeakReference<V>>(size);
_datalen = len; _datalen = len;
try { try {
_rvCon = rvClass.getConstructor(conArg); _rvCon = rvClass.getConstructor(byte[].class);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new RuntimeException("SDSCache init error", e); throw new RuntimeException("SDSCache init error", e);
} }
......
...@@ -111,7 +111,7 @@ public class PortMapper { ...@@ -111,7 +111,7 @@ public class PortMapper {
* @since 0.9.20 * @since 0.9.20
*/ */
public void renderStatusHTML(Writer out) throws IOException { public void renderStatusHTML(Writer out) throws IOException {
List<String> services = new ArrayList(_dir.keySet()); List<String> services = new ArrayList<String>(_dir.keySet());
out.write("<h2>Port Mapper</h2><table><tr><th>Service<th>Host<th>Port\n"); out.write("<h2>Port Mapper</h2><table><tr><th>Service<th>Host<th>Port\n");
Collections.sort(services); Collections.sort(services);
for (String s : services) { for (String s : services) {
......
...@@ -122,7 +122,7 @@ public class SimpleTimer2 { ...@@ -122,7 +122,7 @@ public class SimpleTimer2 {
} }
} }
private ScheduledFuture schedule(TimedEvent t, long timeoutMs) { private ScheduledFuture<?> schedule(TimedEvent t, long timeoutMs) {
return _executor.schedule(t, timeoutMs, TimeUnit.MILLISECONDS); return _executor.schedule(t, timeoutMs, TimeUnit.MILLISECONDS);
} }
...@@ -248,7 +248,7 @@ public class SimpleTimer2 { ...@@ -248,7 +248,7 @@ public class SimpleTimer2 {
private final SimpleTimer2 _pool; private final SimpleTimer2 _pool;
private int _fuzz; private int _fuzz;
protected static final int DEFAULT_FUZZ = 3; protected static final int DEFAULT_FUZZ = 3;
private ScheduledFuture _future; // _executor.remove() doesn't work so we have to use this private ScheduledFuture<?> _future; // _executor.remove() doesn't work so we have to use this
// ... and I expect cancelling this way is more efficient // ... and I expect cancelling this way is more efficient
/** state of the current event. All access should be under lock. */ /** state of the current event. All access should be under lock. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment