Inspectopedia
 
2024.3

'assert' message is not a string

Warning
New
Last modified: 03 December 2024

Reports assert messages that are not of the java.lang.String type.

Using a string provides more information to help diagnose the failure or the assertion reason.

Example:

Use the Only warn when the assert message type is 'boolean' or 'java.lang.Boolean' option to only warn when the assert message type is boolean or java.lang.Boolean. A boolean detail message is unlikely to provide additional information about an assertion failure and could result from a mistakenly entered : instead of &.

This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.