You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Method java.lang.Class#newInstance deprecated in Java 9
Switching to java.lang.reflect.Constructor#newInstance.
According to Javadoc for java.lang.Class#newInstance,
"This method propagates any exception thrown by the nullary
constructor, including a checked exception. Use of this method
effectively bypasses the compile-time exception checking that would
otherwise be performed by the compiler. The Constructor.newInstance
method avoids this problem by wrapping any exception thrown by the
constructor in a (checked) InvocationTargetException. The call
clazz.newInstance()
can be replaced by
clazz.getDeclaredConstructor().newInstance()
0 commit comments