You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case below, we intentionally select an overloaded version of the warn method that takes a single Object argument.
The behaviour is different from the other overloads of Logger.warn (Object... arguments ) or (Throwable t).
The code is correct, but we receive a false positive.
/**
* Log a message at the WARN level according to the specified format
* and argument.
* <p/>
* <p>This form avoids superfluous object creation when the logger
* is disabled for the WARN level. </p>
*
* @param format the format string
* @param arg the argument
*/
public void warn(String format, Object arg);
/**
* Log a message at the WARN level according to the specified format
* and arguments.
* <p/>
* <p>This form avoids superfluous string concatenation when the logger
* is disabled for the WARN level. However, this variant incurs the hidden
* (and relatively small) cost of creating an <code>Object[]</code> before invoking the method,
* even if this logger is disabled for WARN. The variants taking
* {@link #warn(String, Object) one} and {@link #warn(String, Object, Object) two}
* arguments exist solely in order to avoid this hidden cost.</p>
*
* @param format the format string
* @param arguments a list of 3 or more arguments
*/
public void warn(String format, Object... arguments);
/**
* Log an exception (throwable) at the WARN level with an
* accompanying message.
*
* @param msg the message accompanying the exception
* @param t the exception (throwable) to log
*/
public void warn(String msg, Throwable t);
The first one never checks for the argument being a Throwable, and therefore the code is correct.
In the case below, we intentionally select an overloaded version of the
warn
method that takes a singleObject
argument.The behaviour is different from the other overloads of
Logger.warn
(Object... arguments
) or (Throwable t
).The code is correct, but we receive a false positive.
The first one never checks for the argument being a Throwable, and therefore the code is correct.
Version:
The text was updated successfully, but these errors were encountered: