There is no SLF4J API method that takes a format String, args, and a Throwable - here we are using error(String msg, Throwable e), so the comment about format specifiers is a false-positive.
It will compile since error(String msg, Object e1, Object e2) will be called, and will result in a correctly formatted message if slf4j.simple.SimpleLogger is used for example.
That being said, is your concern the fact that this last argument may not be correctly supported depending on the logger used?
Do you have a specific example by any chance?
In general:
The behavior of “taking the last format argument and interpreting it as a Throwable” seems to be an implementation detail of SLF4J SimpleLogger / Logback.
I feel it is wrong to assume this implementation detail is present in all SLF4J API implementations (it is not documented in the API docs after all).
In our case:
We are using Logback, so what you suggested would make the Sonar issues go away. But I’m not sure we want to.