質問

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

役に立ちましたか?

解決 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.

他のヒント

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top