To quote Java 9's javadoc:
The call
clazz.newInstance()
can be replaced by
clazz.getDeclaredConstructor().newInstance()
Class.getDeclaredConstructor(...).newInstance(...)
Refer to Google errorprone's documentation (for example) for a description of why.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With