ConfigSuite: Instantiate class via getDeclaredConstructor()

ErrorProne reports a warning [1] about bypassing exception checking
by instantiation with direct call to #newInstance. It also mentions
that #newInstance is to be deprecated from Java 9.

[1] http://errorprone.info/bugpattern/ClassNewInstance

Change-Id: Id20631933bce8ab320dd5e321336bad9e181cfa0
This commit is contained in:
David Pursehouse
2018-09-03 11:04:14 +09:00
parent 8c9f93493a
commit 8f4d9b58c6

View File

@@ -120,7 +120,7 @@ public class ConfigSuite extends Suite {
@Override
public Object createTest() throws Exception {
Object test = getTestClass().getJavaClass().newInstance();
Object test = getTestClass().getJavaClass().getDeclaredConstructor().newInstance();
parameterField.set(test, callConfigMethod(configMethod));
if (nameField != null) {
nameField.set(test, name);