Pregunta

My question is short. Are method preconditions and postconditions enforced by the compiler?

¿Fue útil?

Solución 2

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.

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
scroll top