Commit afe4045b authored by Karsten Loesing's avatar Karsten Loesing
Browse files

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.
parent 941ffd69
...@@ -524,9 +524,9 @@ public class DocumentStore { ...@@ -524,9 +524,9 @@ public class DocumentStore {
Class<T> documentType, String documentString) { Class<T> documentType, String documentString) {
T result = null; T result = null;
try { try {
result = documentType.newInstance(); result = documentType.getDeclaredConstructor().newInstance();
result.setFromDocumentString(documentString); result.setFromDocumentString(documentString);
} catch (InstantiationException | IllegalAccessException e) { } catch (ReflectiveOperationException e) {
/* Handle below. */ /* Handle below. */
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
...@@ -558,9 +558,9 @@ public class DocumentStore { ...@@ -558,9 +558,9 @@ public class DocumentStore {
Class<T> documentType, String documentString) { Class<T> documentType, String documentString) {
T result = null; T result = null;
try { try {
result = documentType.newInstance(); result = documentType.getDeclaredConstructor().newInstance();
result.setDocumentString(documentString); result.setDocumentString(documentString);
} catch (InstantiationException | IllegalAccessException e) { } catch (ReflectiveOperationException e) {
/* Handle below. */ /* Handle below. */
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment