Have a look at Contracts for Java, which helps enforing pre- and postconditions as well as invariants through annotations. But there's no compile-time-checking, only runtime as far as I know.
Java - Method Preconditions and postcondition enforcement [closed]
-
10-10-2022 - |
Pregunta
My question is short. Are method preconditions and postconditions enforced by the compiler?
Solución 2
Otros consejos
No. Java doesn't have explicit support for design-by-contract pre/postconditions like (for instance) Ada does. See the java docs
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow