RSS Feed Subscribe to RSS Feed

 

Getting rid of IntelliJ warning: Value ‘yourVariable’ is always ‘null’

IntelliJ was giving me a warning message like this:

Value ‘yourVariable’ is always ‘null’

I often set values to be null for tests (e.g. checking a method can deal with a null parameter), so I wanted to disable this warning.

To do so, deselect the following:

Preferences -> Editor -> Inspections -> Probable bugs -> Constant conditions and exceptions -> Warn when reading a value guaranteed to be constant.

Or you can setup custom handling for tests (e.g. weak warnings) under Severity by Scope.

(Based on IntelliJ 14)

Tags:

Leave a Reply