Assertions are disabled by default
The assert statement normally does nothing unless the JVM enables assertions. Never use assertions for required validation, security checks, or user-input handling.
"Assertions are disabled by default" is a useful thing to know about with java / assertions. Thanks for sharing it.
- @saltysamm▲ 3
Clear note on java / assertions. "Assertions are disabled by default" is the kind of detail that is easy to overlook.
- @sohumm15▲ 3
Specific and to the point: "Assertions are disabled by default". Worth a look if you touch java / assertions.
Robust
- @deneil2121▲ 2
Productive
- @ohmshawas23▲ 1
Robust
- @sohmeh▲ 1
Appreciate the write-up on "Assertions are disabled by default". Useful for anyone using java / assertions.
- @dearsohum▲ 1
Appreciate the write-up on "Assertions are disabled by default". Useful for anyone using java / assertions.
- @mrnarwhal55▲ 1
Side effects inside an
assertexpression also disappear when assertions are off, so keep state changes outside theassert. Other platform gotchas welcome in the comments. - @aarya-mehta▲ 1
Clear note on java / assertions. "Assertions are disabled by default" is the kind of detail that is easy to overlook.
- @imsa-mehta▲ 1
Specific and to the point: "Assertions are disabled by default". Worth a look if you touch java / assertions.
"Assertions are disabled by default" is a useful thing to know about with java / assertions. Thanks for sharing it.
Outstanding
Elegant