Power asserts are a feature found in Groovy, and which can be added to Java and Kotlin using third party compiler plugins. They replace the default empty "Assertion failed" exception message with a diagram of the expression showing the values at each point. This makes assertions failures significantly more useful.
The concept is well documented in the README of this project and it shows some example output.
https://github.com/jkschneider/java-power-assert
Most power assert libraries also let the user define a list of assertion functions that trigger this behavior.
Power assertions generally require messing with the compiler internals. It's a feature that would be better implemented by javac itself. The code already exists in the above project and is Apache licensed, so it could be easily adapted if the author could be contacted for CLA reasons, or alternatively reimplemented.
The downside to most implementations is of course a lot more byte code gets generated, because the full expression is emitted. So it would make sense to only do this when emitting debug info.
The concept is well documented in the README of this project and it shows some example output.
https://github.com/jkschneider/java-power-assert
Most power assert libraries also let the user define a list of assertion functions that trigger this behavior.
Power assertions generally require messing with the compiler internals. It's a feature that would be better implemented by javac itself. The code already exists in the above project and is Apache licensed, so it could be easily adapted if the author could be contacted for CLA reasons, or alternatively reimplemented.
The downside to most implementations is of course a lot more byte code gets generated, because the full expression is emitted. So it would make sense to only do this when emitting debug info.