Code inspection: Redundant argument with default value
This inspection identifies places in your code where you call methods that have optional arguments, and use values that are identical to the default values for those arguments.
Here is an example:
The above call uses values identical to the default ones for both optional arguments, optionalBool
and optionalInt
, and this is somewhat ambiguous: is this call supposed to use the default values specified in the declaration of Foo()
or, on the contrary, is it supposed to use the values specified by the caller independently of what the default values are?
If the former is the case, optional arguments with default values can and should be removed because the default values could change later in the declaration. Otherwise, you can just suppress this inspection with the comment: