@@ -46,23 +46,7 @@ private Klass() {
46
46
public static <T > T newInstance (Class <T > klass ) {
47
47
try {
48
48
return klass .getDeclaredConstructor ().newInstance ();
49
- } catch (IllegalAccessException e ) {
50
- String msg = "Can't create an instance of " + klass
51
- + ", requires a public no-arg constructor: " + e ;
52
- throw new IllegalArgumentException (msg , e );
53
- } catch (IllegalArgumentException e ) {
54
- String msg = "Can't create an instance of " + klass
55
- + ", requires a public no-arg constructor: " + e ;
56
- throw new IllegalArgumentException (msg , e );
57
- } catch (InstantiationException e ) {
58
- String msg = "Can't create an instance of " + klass
59
- + ", requires a public no-arg constructor: " + e ;
60
- throw new IllegalArgumentException (msg , e );
61
- } catch (NoSuchMethodException e ) {
62
- String msg = "Can't create an instance of " + klass
63
- + ", requires a public no-arg constructor: " + e ;
64
- throw new IllegalArgumentException (msg , e );
65
- } catch (SecurityException e ) {
49
+ } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException e ) {
66
50
String msg = "Can't create an instance of " + klass
67
51
+ ", requires a public no-arg constructor: " + e ;
68
52
throw new IllegalArgumentException (msg , e );
0 commit comments