Replace deprecated newInstance invocation
Change-Id: Ic74611cc3203ef12dd58f7c2134f52c85a4a2ecc
diff --git a/src/main/java/de/ids_mannheim/korap/tokenizer/KorapTokenizer.java b/src/main/java/de/ids_mannheim/korap/tokenizer/KorapTokenizer.java
index ba5a882..b6ff7e4 100644
--- a/src/main/java/de/ids_mannheim/korap/tokenizer/KorapTokenizer.java
+++ b/src/main/java/de/ids_mannheim/korap/tokenizer/KorapTokenizer.java
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
+import java.lang.reflect.InvocationTargetException;
/**
* The interface Korap tokenizer.
@@ -208,8 +209,8 @@
* @throws IllegalAccessException the illegal access exception
* @throws InstantiationException the instantiation exception
*/
- public KorapTokenizer build() throws IllegalAccessException, InstantiationException {
- KorapTokenizer korapTokenizer = (KorapTokenizer) tokenizerClass.newInstance();
+ public KorapTokenizer build() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
+ KorapTokenizer korapTokenizer = (KorapTokenizer) tokenizerClass.getDeclaredConstructor().newInstance();
korapTokenizer.setEcho(echo);
korapTokenizer.setInputReader(inputReader);
korapTokenizer.setOutputStream(outputStream);
diff --git a/src/test/java/de/ids_mannheim/korap/tokenizer/TokenizerTest.java b/src/test/java/de/ids_mannheim/korap/tokenizer/TokenizerTest.java
index 6664fa2..69351e9 100644
--- a/src/test/java/de/ids_mannheim/korap/tokenizer/TokenizerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/tokenizer/TokenizerTest.java
@@ -11,6 +11,7 @@
import org.junit.runners.JUnit4;
import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
@RunWith(JUnit4.class)
public class TokenizerTest {
@@ -717,7 +718,7 @@
}
@Test
- public void testTextBreakOutputArchive () throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ public void testTextBreakOutputArchive () throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
DerekoDfaTokenizer_de tok = (DerekoDfaTokenizer_de) new KorapTokenizer.Builder()
.tokenizerClassName(DerekoDfaTokenizer_de.class.getName())
.printOffsets(true)