forked from I2P_Developers/i2p.i2p
Fix calls to Class.newInstance() deprecated in Java 9
This commit is contained in:
@ -88,7 +88,7 @@ public class IdenticonServlet extends HttpServlet {
|
|||||||
if (cacheProvider != null) {
|
if (cacheProvider != null) {
|
||||||
try {
|
try {
|
||||||
Class<?> cacheClass = Class.forName(cacheProvider);
|
Class<?> cacheClass = Class.forName(cacheProvider);
|
||||||
this.cache = (IdenticonCache) cacheClass.newInstance();
|
this.cache = (IdenticonCache) cacheClass.getDeclaredConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class QRServlet extends HttpServlet {
|
|||||||
if (cacheProvider != null) {
|
if (cacheProvider != null) {
|
||||||
try {
|
try {
|
||||||
Class<?> cacheClass = Class.forName(cacheProvider);
|
Class<?> cacheClass = Class.forName(cacheProvider);
|
||||||
this.cache = (IdenticonCache) cacheClass.newInstance();
|
this.cache = (IdenticonCache) cacheClass.getDeclaredConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class EncodingFactory {
|
|||||||
for( int i = 0; i < classNames.length; i++ ) {
|
for( int i = 0; i < classNames.length; i++ ) {
|
||||||
try {
|
try {
|
||||||
Class<?> c = Class.forName( classNames[i] );
|
Class<?> c = Class.forName( classNames[i] );
|
||||||
Encoding e = (Encoding)c.newInstance();
|
Encoding e = (Encoding) (c.getDeclaredConstructor().newInstance());
|
||||||
encodings.put( e.getName(), e );
|
encodings.put( e.getName(), e );
|
||||||
Debug.debug( Debug.DEBUG, "Registered " + e.getClass().getName() );
|
Debug.debug( Debug.DEBUG, "Registered " + e.getClass().getName() );
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ public class KBucketSet<T extends SimpleDataStructure> {
|
|||||||
throw new IllegalArgumentException("bad length " + dlen + " > " + len);
|
throw new IllegalArgumentException("bad length " + dlen + " > " + len);
|
||||||
T rv;
|
T rv;
|
||||||
try {
|
try {
|
||||||
rv = (T) _us.getClass().newInstance();
|
rv = (T) _us.getClass().getDeclaredConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("fail", e);
|
_log.error("fail", e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -269,7 +269,7 @@ public class UPnP
|
|||||||
if(parserClass[i]==null)
|
if(parserClass[i]==null)
|
||||||
continue;
|
continue;
|
||||||
try {
|
try {
|
||||||
parser = (Parser) Class.forName(parserClass[i]).newInstance();
|
parser = (Parser) Class.forName(parserClass[i]).getDeclaredConstructor().newInstance();
|
||||||
return parser;
|
return parser;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Debug.warning("Unable to load "+parserClass[i]+" as XMLParser due to "+e);
|
Debug.warning("Unable to load "+parserClass[i]+" as XMLParser due to "+e);
|
||||||
|
Reference in New Issue
Block a user