For many methods, ignoring the result is perfectly
legitimate, but for some it is almost certainly an error. Examples of methods where ignoring
the result is likely an error include java.io.inputStream.read()
,
which returns the number of bytes actually read, and any method on
java.lang.String
or java.math.BigInteger
. These methods do not produce side-effects and thus pointless
if their result is ignored.
The calls to the following methods are inspected:
org.jetbrains.annotations.Contract(pure=true)
CheckReturnValue
javax.annotation.CheckReturnValue
Calls to methods annotated with Error Prone's or AssertJ's @CanIgnoreReturnValue
annotation are not reported.
Use the inspection settings to specify the classes to check. Methods are matched by name or name pattern using Java regular expression syntax. For classes, use fully-qualified names. Each entry applies to both the class and all its inheritors.