如何禁用“可选用作字段或参数类型"? IntelliJ中警告? [英] How to disable the "Optional used as field or parameter type" warning in IntelliJ?

查看:193
本文介绍了如何禁用“可选用作字段或参数类型"? IntelliJ中警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jetbrains最近决定 java.util.Optional (以及Guava的 com.google.common.base.Optional )不应用作字段或参数类型...谢谢,不,谢谢...如何禁用此警告?

Jetbrains has recently decided that java.util.Optional (as well as Guava's com.google.common.base.Optional) shouldn't be used as field or parameter type... thanks, but no thanks... How can this warning be disabled?

作为旁注:针对Optional的这种特定用法触发警告似乎完全没有道理...

As a side note: triggering warnings on this specific usage of Optional seems completely unjustified...

推荐答案

根据IntelliJ的首选项/设置:

From IntelliJ's preferences/settings:

  1. 选择Editor> Inspections
  2. 展开Java> Abstraction issues
  3. 取消选中'Optional' used as field or parameter type
  1. Select Editor > Inspections
  2. Expand Java > Abstraction issues
  3. Uncheck 'Optional' used as field or parameter type

这篇关于如何禁用“可选用作字段或参数类型"? IntelliJ中警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆