JythonShell: Fix ClassNewInstance warning flagge by error prone
The following warning is issued on the base version by error prone:
warning: [ClassNewInstance] Class.newInstance() bypasses exception
checking; prefer getConstructor().newInstance()
shell = console.newInstance();
^
(see http://errorprone.info/bugpattern/ClassNewInstance)
Did you mean 'shell = console.getConstructor().newInstance();'?
Change-Id: Ia3b474422965851ae1f64de4f2767179af33bf12
This commit is contained in:
committed by
David Pursehouse
parent
48a05061fc
commit
a0cb16567a
@@ -78,9 +78,14 @@ public class JythonShell {
|
||||
new Object[] {null, env});
|
||||
|
||||
try {
|
||||
shell = console.newInstance();
|
||||
shell = console.getConstructor(new Class[] {}).newInstance();
|
||||
log.info("Jython shell instance created.");
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
} catch (InstantiationException
|
||||
| IllegalAccessException
|
||||
| IllegalArgumentException
|
||||
| InvocationTargetException
|
||||
| NoSuchMethodException
|
||||
| SecurityException e) {
|
||||
throw noInterpreter(e);
|
||||
}
|
||||
injectedVariables = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user