javapreconditionspost-conditions

Java - Method Preconditions and postcondition enforcement


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


Solution

  • 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.