Frage

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

War es hilfreich?

Lösung 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.

Andere Tipps

No. Java doesn't have explicit support for design-by-contract pre/postconditions like (for instance) Ada does. See the java docs

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top