style: 适配 Java 16 新特性

1.instanceof 模式匹配(Java 14 预览特性 => Java 16 标准特性)
详情请参阅:https://docs.oracle.com/en/java/javase/16/language/pattern-matching-instanceof-operator.html
This commit is contained in:
2023-03-31 23:08:50 +08:00
parent 38f52aaafa
commit cf3044312c
6 changed files with 8 additions and 16 deletions

View File

@@ -44,9 +44,8 @@ public class ExceptionUtils {
* 异常
*/
public static void printException(Runnable runnable, Throwable throwable) {
if (throwable == null && runnable instanceof Future<?>) {
if (throwable == null && runnable instanceof Future<?> future) {
try {
Future<?> future = (Future<?>)runnable;
if (future.isDone()) {
future.get();
}