|
|
@@ -5,8 +5,6 @@ import static de.jplag.options.Verbosity.LONG;
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.FileReader;
|
|
|
import java.io.IOException;
|
|
|
-import java.lang.reflect.Constructor;
|
|
|
-import java.lang.reflect.InvocationTargetException;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Optional;
|
|
|
import java.util.Set;
|
|
|
@@ -19,7 +17,6 @@ import de.jplag.clustering.ClusteringFactory;
|
|
|
import de.jplag.exceptions.ExitException;
|
|
|
import de.jplag.exceptions.SubmissionException;
|
|
|
import de.jplag.options.JPlagOptions;
|
|
|
-import de.jplag.options.LanguageOption;
|
|
|
import de.jplag.strategy.ComparisonMode;
|
|
|
import de.jplag.strategy.ComparisonStrategy;
|
|
|
import de.jplag.strategy.NormalComparisonStrategy;
|
|
|
@@ -109,23 +106,12 @@ public class JPlag {
|
|
|
}
|
|
|
|
|
|
private Language initializeLanguage() {
|
|
|
- LanguageOption languageOption = this.options.getLanguageOption();
|
|
|
-
|
|
|
- try {
|
|
|
- Constructor<?> constructor = Class.forName(languageOption.getClassPath()).getConstructor(ErrorConsumer.class);
|
|
|
- Object[] constructorParams = {errorCollector};
|
|
|
-
|
|
|
- Language language = (Language) constructor.newInstance(constructorParams);
|
|
|
-
|
|
|
- this.options.setLanguage(language);
|
|
|
- this.options.setLanguageDefaults(language);
|
|
|
- logger.info("Initialized language " + language.getName());
|
|
|
- return language;
|
|
|
- } catch (NoSuchMethodException | SecurityException | ClassNotFoundException | InstantiationException | IllegalAccessException
|
|
|
- | IllegalArgumentException | InvocationTargetException e) {
|
|
|
- e.printStackTrace();
|
|
|
- throw new IllegalStateException("Language instantiation failed:" + e.getMessage());
|
|
|
- }
|
|
|
+ Language uninitializedLanguage = this.options.getLanguage();
|
|
|
|
|
|
+ Language language = uninitializedLanguage.initializeLanguage(errorCollector);
|
|
|
+ this.options.setLanguage(language);
|
|
|
+ this.options.setLanguageDefaults(language);
|
|
|
+ logger.info("Initialized language " + language.getName());
|
|
|
+ return language;
|
|
|
}
|
|
|
}
|