英文:
Code inspection is not working! Intellij IDE
问题
我在使用IntelliJ Ultimate的代码检查功能时遇到了问题!
它只显示基本的代码替换检查/替代选项,比如“反转if条件”,没有其他内容。
我已经在首选项中检查了是否选择了所有内容,还重新安装了IntelliJ,但仍然不起作用!
它过去会给我更多的代码替换选项,不仅仅是“反转if条件”,还有更多的选择。其中之一是
“使用函数式风格表达式替换Optional.isPresent()条件”
因此,无论我写什么:
if (userOptional.isPresent()) {
return ResponseEntity.ok(userOptional.get());
}
return ResponseEntity.status(HttpStatus.NOT_FOUND).
body(new ErrorMessage("User " + id + " was not found"));
... 它过去会给我这种替换方式:
return userOptional.<ResponseEntity<?>>map(ResponseEntity::ok)
.orElseGet(()->ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(new ErrorMessage("User " + id + " was not found")));
英文:
I am having problems with intellijs Ultimate code inspection!
It is only showing me the basic inspection/alternatives for code replacement like "Invert if condition" and nothing else.
I have checked on the preferences if everything is selected and I also reinstalled intellij but still not working!
It used to give me more alternatives for code replacement not only the "Invert if condition" but there were more alternatives. One of them was
"Replace Optional.isPresent() condition with functional style expression"
So whenever I wrote :
if (userOptional.isPresent()) {
return ResponseEntity.ok(userOptional.get());
}
return ResponseEntity.status(HttpStatus.NOT_FOUND).
body(new ErrorMessage("User " + id + " was not found"));
... it used to give me this kind of replacement:
return userOptional.<ResponseEntity<?>>map(ResponseEntity::ok)
.orElseGet(()->ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(new ErrorMessage("User " + id + " was not found")));
专注分享java语言的经验与见解,让所有开发者获益!
评论