[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [onionoo/release] Remove deprecation warning.
commit afe4045b50330bf0c65eeae393eeefebfa191817
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Wed Nov 20 11:16:03 2019 +0100
Remove deprecation warning.
Class#newInstance is deprecated in Java 9 and higher, which doesn't
affect us yet in Java 8. But the suggested replacement already works
in Java 8, so that we can safely switch to that.
---
.../java/org/torproject/metrics/onionoo/docs/DocumentStore.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/torproject/metrics/onionoo/docs/DocumentStore.java b/src/main/java/org/torproject/metrics/onionoo/docs/DocumentStore.java
index 778bab9..2963db2 100644
--- a/src/main/java/org/torproject/metrics/onionoo/docs/DocumentStore.java
+++ b/src/main/java/org/torproject/metrics/onionoo/docs/DocumentStore.java
@@ -524,9 +524,9 @@ public class DocumentStore {
Class<T> documentType, String documentString) {
T result = null;
try {
- result = documentType.newInstance();
+ result = documentType.getDeclaredConstructor().newInstance();
result.setFromDocumentString(documentString);
- } catch (InstantiationException | IllegalAccessException e) {
+ } catch (ReflectiveOperationException e) {
/* Handle below. */
log.error(e.getMessage(), e);
}
@@ -558,9 +558,9 @@ public class DocumentStore {
Class<T> documentType, String documentString) {
T result = null;
try {
- result = documentType.newInstance();
+ result = documentType.getDeclaredConstructor().newInstance();
result.setDocumentString(documentString);
- } catch (InstantiationException | IllegalAccessException e) {
+ } catch (ReflectiveOperationException e) {
/* Handle below. */
log.error(e.getMessage(), e);
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits