GerritLauncher: Fix ClassNewInstance warning flagged 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()
        res = main.invoke(clazz.newInstance(), new Object[] {argv});
                                           ^
    (see http://errorprone.info/bugpattern/ClassNewInstance)
  Did you mean 'res = main.invoke(clazz.getConstructor().newInstance(),
new Object[] {argv});'?
Change-Id: I669f2c58ef60257d1b10dca294cc14d5c60e6171
			
			
This commit is contained in:
		
				
					committed by
					
						
						David Pursehouse
					
				
			
			
				
	
			
			
			
						parent
						
							a0cb16567a
						
					
				
				
					commit
					2634933198
				
			@@ -200,7 +200,7 @@ public final class GerritLauncher {
 | 
			
		||||
      if ((main.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
 | 
			
		||||
        res = main.invoke(null, new Object[] {argv});
 | 
			
		||||
      } else {
 | 
			
		||||
        res = main.invoke(clazz.newInstance(), new Object[] {argv});
 | 
			
		||||
        res = main.invoke(clazz.getConstructor(new Class[] {}).newInstance(), new Object[] {argv});
 | 
			
		||||
      }
 | 
			
		||||
    } catch (InvocationTargetException ite) {
 | 
			
		||||
      if (ite.getCause() instanceof Exception) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user