Nymph2333
2023-04-10 af0e0a110e7187bf008655f7510199a0c0b25ec4
refs
author Nymph2333 <498092988@qq.com>
Monday, April 10, 2023 14:27 +0800
committer Gitee <noreply@gitee.com>
Monday, April 10, 2023 14:27 +0800
commitaf0e0a110e7187bf008655f7510199a0c0b25ec4
tree f7d23a49ebfa133500b92ac06fe23370c3a45da3 tree | zip | gz
parent a33090c90e71100a4337d274a5e58ea8e72e6d65 view | diff
newInstance() 已弃用,使用clazz.getDeclaredConstructor().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()
The latter sequence of calls is inferred to be able to throw the additional exception types InvocationTargetException and NoSuchMethodException. Both of these exception types are subclasses of ReflectiveOperationException.

Signed-off-by: Nymph2333 <498092988@qq.com>
1 files modified
2 ■■■ changed files
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java 2 ●●● diff | view | raw | blame | history