forked from I2P_Developers/i2p.i2p
Class generics
This commit is contained in:
@ -38,8 +38,8 @@ public class MetaNamingService extends DummyNamingService {
|
||||
_services = new CopyOnWriteArrayList<NamingService>();
|
||||
while (tok.hasMoreTokens()) {
|
||||
try {
|
||||
Class cls = Class.forName(tok.nextToken());
|
||||
Constructor con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
Class<?> cls = Class.forName(tok.nextToken());
|
||||
Constructor<?> con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
addNamingService((NamingService)con.newInstance(new Object[] { context }), false);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
@ -462,8 +462,8 @@ public abstract class NamingService {
|
||||
NamingService instance = null;
|
||||
String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL);
|
||||
try {
|
||||
Class cls = Class.forName(impl);
|
||||
Constructor con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
Class<?> cls = Class.forName(impl);
|
||||
Constructor<?> con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
instance = (NamingService)con.newInstance(new Object[] { context });
|
||||
} catch (Exception ex) {
|
||||
Log log = context.logManager().getLog(NamingService.class);
|
||||
|
@ -41,8 +41,8 @@ class ECConstants {
|
||||
boolean loaded;
|
||||
if (Security.getProvider("BC") == null) {
|
||||
try {
|
||||
Class cls = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||
Constructor con = cls.getConstructor(new Class[0]);
|
||||
Class<?> cls = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||
Constructor<?> con = cls.getConstructor(new Class[0]);
|
||||
Provider bc = (Provider)con.newInstance(new Object[0]);
|
||||
Security.addProvider(bc);
|
||||
log("Added BC provider");
|
||||
|
@ -295,7 +295,7 @@ public class FileUtil {
|
||||
//Pack200.newUnpacker().unpack(in, out);
|
||||
if (!_failedOracle) {
|
||||
try {
|
||||
Class p200 = Class.forName("java.util.jar.Pack200", true, ClassLoader.getSystemClassLoader());
|
||||
Class<?> p200 = Class.forName("java.util.jar.Pack200", true, ClassLoader.getSystemClassLoader());
|
||||
Method newUnpacker = p200.getMethod("newUnpacker", (Class[]) null);
|
||||
Object unpacker = newUnpacker.invoke(null,(Object[]) null);
|
||||
Method unpack = unpacker.getClass().getMethod("unpack", new Class[] {InputStream.class, JarOutputStream.class});
|
||||
@ -316,8 +316,8 @@ public class FileUtil {
|
||||
//(new Archive(in, out)).unpack();
|
||||
if (!_failedApache) {
|
||||
try {
|
||||
Class p200 = Class.forName("org.apache.harmony.unpack200.Archive", true, ClassLoader.getSystemClassLoader());
|
||||
Constructor newUnpacker = p200.getConstructor(new Class[] {InputStream.class, JarOutputStream.class});
|
||||
Class<?> p200 = Class.forName("org.apache.harmony.unpack200.Archive", true, ClassLoader.getSystemClassLoader());
|
||||
Constructor<?> newUnpacker = p200.getConstructor(new Class[] {InputStream.class, JarOutputStream.class});
|
||||
Object unpacker = newUnpacker.newInstance(new Object[] {in, out});
|
||||
Method unpack = unpacker.getClass().getMethod("unpack", (Class[]) null);
|
||||
// throws IOException or Pack200Exception
|
||||
|
@ -25,7 +25,7 @@ import net.i2p.I2PAppContext;
|
||||
* @author jrandom
|
||||
*/
|
||||
public class Log {
|
||||
private final Class _class;
|
||||
private final Class<?> _class;
|
||||
private final String _className;
|
||||
private final String _name;
|
||||
private int _minPriority;
|
||||
@ -75,7 +75,7 @@ public class Log {
|
||||
* Warning - not recommended.
|
||||
* Use I2PAppContext.getGlobalContext().logManager().getLog(cls)
|
||||
*/
|
||||
public Log(Class cls) {
|
||||
public Log(Class<?> cls) {
|
||||
this(I2PAppContext.getGlobalContext().logManager(), cls, null);
|
||||
_manager.addLog(this);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class Log {
|
||||
_manager.addLog(this);
|
||||
}
|
||||
|
||||
Log(LogManager manager, Class cls) {
|
||||
Log(LogManager manager, Class<?> cls) {
|
||||
this(manager, cls, null);
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public class Log {
|
||||
this(manager, null, name);
|
||||
}
|
||||
|
||||
Log(LogManager manager, Class cls, String name) {
|
||||
Log(LogManager manager, Class<?> cls, String name) {
|
||||
_manager = manager;
|
||||
_class = cls;
|
||||
_className = cls != null ? cls.getName() : null;
|
||||
@ -229,7 +229,7 @@ public class Log {
|
||||
/** @return the LogScope (private class) */
|
||||
public Object getScope() { return _scope; }
|
||||
|
||||
static String getScope(String name, Class cls) {
|
||||
static String getScope(String name, Class<?> cls) {
|
||||
if ( (name == null) && (cls == null) ) return "f00";
|
||||
if (cls == null) return name;
|
||||
if (name == null) return cls.getName();
|
||||
@ -239,7 +239,7 @@ public class Log {
|
||||
private static final class LogScope {
|
||||
private final String _scopeCache;
|
||||
|
||||
public LogScope(String name, Class cls) {
|
||||
public LogScope(String name, Class<?> cls) {
|
||||
_scopeCache = getScope(name, cls);
|
||||
}
|
||||
|
||||
|
@ -166,9 +166,9 @@ public class LogManager {
|
||||
t.start();
|
||||
}
|
||||
|
||||
public Log getLog(Class cls) { return getLog(cls, null); }
|
||||
public Log getLog(Class<?> cls) { return getLog(cls, null); }
|
||||
public Log getLog(String name) { return getLog(null, name); }
|
||||
public Log getLog(Class cls, String name) {
|
||||
public Log getLog(Class<?> cls, String name) {
|
||||
String scope = Log.getScope(name, cls);
|
||||
boolean isNew = false;
|
||||
Log rv = _logs.get(scope);
|
||||
|
@ -15,14 +15,14 @@ package net.i2p.util;
|
||||
*/
|
||||
class LogRecord {
|
||||
private final long _date;
|
||||
private final Class _source;
|
||||
private final Class<?> _source;
|
||||
private final String _name;
|
||||
private final String _threadName;
|
||||
private final int _priority;
|
||||
private final String _message;
|
||||
private final Throwable _throwable;
|
||||
|
||||
public LogRecord(Class src, String name, String threadName, int priority, String msg, Throwable t) {
|
||||
public LogRecord(Class<?> src, String name, String threadName, int priority, String msg, Throwable t) {
|
||||
_date = Clock.getInstance().now();
|
||||
_source = src;
|
||||
_name = name;
|
||||
@ -36,7 +36,7 @@ class LogRecord {
|
||||
return _date;
|
||||
}
|
||||
|
||||
public Class getSource() {
|
||||
public Class<?> getSource() {
|
||||
return _source;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public abstract class SystemVersion {
|
||||
int sdk = 0;
|
||||
if (_isAndroid) {
|
||||
try {
|
||||
Class ver = Class.forName("android.os.Build.VERSION", true, ClassLoader.getSystemClassLoader());
|
||||
Class<?> ver = Class.forName("android.os.Build.VERSION", true, ClassLoader.getSystemClassLoader());
|
||||
Field field = ver.getField("SDK_INT");
|
||||
sdk = field.getInt(null);
|
||||
} catch (Exception e) {}
|
||||
|
Reference in New Issue
Block a user