Use getDeclaredConstructor() so exception checking isn't bypassed

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173412751
This commit is contained in:
mcilwain 2017-10-25 10:08:46 -07:00 committed by jianglai
parent 113c5af2a5
commit ec5c9e4474

View file

@ -79,7 +79,7 @@ final class RegistryCli {
commandInstances.put("help", helpCommand); commandInstances.put("help", helpCommand);
for (Map.Entry<String, ? extends Class<? extends Command>> entry : commands.entrySet()) { for (Map.Entry<String, ? extends Class<? extends Command>> entry : commands.entrySet()) {
Command command = entry.getValue().newInstance(); Command command = entry.getValue().getDeclaredConstructor().newInstance();
jcommander.addCommand(entry.getKey(), command); jcommander.addCommand(entry.getKey(), command);
commandInstances.put(entry.getKey(), command); commandInstances.put(entry.getKey(), command);
} }