Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the "Optional used as field or parameter type" warning in IntelliJ? [duplicate]

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?

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

like image 326
Andrey Avatar asked Mar 22 '16 22:03

Andrey


People also ask

How do you make a parameter optional in Java?

There are no optional parameters in Java. What you can do is overloading the functions and then passing default values.


1 Answers

From IntelliJ's preferences/settings:

  1. Select Editor > Inspections
  2. Expand Java > Abstraction issues
  3. Uncheck 'Optional' used as field or parameter type
like image 161
Andrey Avatar answered Oct 01 '22 04:10

Andrey