summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorgjoranv <gv@oath.com>2018-05-02 13:46:48 +0200
committergjoranv <gv@oath.com>2018-05-02 15:32:04 +0200
commitfe55812c90a3346e3a1b7e632a44f554a34cb854 (patch)
tree20fc8276d79f255a6d834dc9b2e65647956ceceb /config
parenta9dd0c5a4771d208554ccc6663d07ba81a037496 (diff)
Replace usage of apis deprecated in Java 9.
Diffstat (limited to 'config')
-rw-r--r--config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java2
-rw-r--r--config/src/main/java/com/yahoo/vespa/config/buildergen/LazyConfigCompiler.java6
2 files changed, 5 insertions, 3 deletions
diff --git a/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java b/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java
index 3e9df32decb..a7076d0e32a 100644
--- a/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java
+++ b/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java
@@ -109,7 +109,7 @@ public class StressTester {
threadList.clear();
testRunners.clear();
for (int i = 0; i < threads; i++) {
- Tester tester = (Tester) testClass.newInstance();
+ Tester tester = (Tester) testClass.getDeclaredConstructor().newInstance();
TestRunner testRunner = new TestRunner(tester);
testRunners.add(testRunner);
Thread t = new Thread(testRunner);
diff --git a/config/src/main/java/com/yahoo/vespa/config/buildergen/LazyConfigCompiler.java b/config/src/main/java/com/yahoo/vespa/config/buildergen/LazyConfigCompiler.java
index b0828d2766e..634b23e3e1b 100644
--- a/config/src/main/java/com/yahoo/vespa/config/buildergen/LazyConfigCompiler.java
+++ b/config/src/main/java/com/yahoo/vespa/config/buildergen/LazyConfigCompiler.java
@@ -5,6 +5,7 @@ import com.yahoo.config.ConfigInstance;
import javax.tools.*;
import java.io.File;
+import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -76,8 +77,9 @@ public class LazyConfigCompiler implements ConfigCompiler {
private <BUILDER extends ConfigInstance.Builder> BUILDER loadBuilder(String builderClassUrl) {
try {
Class<BUILDER> clazz = (Class<BUILDER>) classLoader.<BUILDER>loadClass(builderClassUrl);
- return clazz.newInstance();
- } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
+ return clazz.getDeclaredConstructor().newInstance();
+ } catch (ClassNotFoundException | IllegalAccessException | InstantiationException
+ | NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Error creating new instance of '" + builderClassUrl + "'", e);
}
}