문제

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