-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
@Async
private JPromise<Void> simpleAwait() {
Object obj = null;
// 这种写法没问题
if (obj instanceof String) {
String stringObj = (String) obj;
JAsync.just(null).await();
System.out.println(stringObj);
}
// 这种写法编译报错
if (obj instanceof String stringObj) {
JAsync.just(null).await();
System.out.println(stringObj);
}
return JAsync.just(null);
}
public static void main(String[] args) {
App app = new App();
System.out.println(app.simpleAwait().block());
}
报
System.out.println(stringObj);
^
符号: 变量 stringObj
位置: 类 App
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels