diesieben07
09/03/2017, 12:14 PMrequireXXX
(for "check incoming arguments") nor checkXXX
(for "check if this method may be called right now") are appropriate for an "this internal state must be like this or I made a programmer error".arekolek
09/04/2017, 2:05 PMcheckXXX
appropriate in your opinion? It throws an IllegalStateException
, and if you look at the samples https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/samples/test/samples/misc/preconditions.kt they use it to check state.diesieben07
09/04/2017, 6:29 PMIllegalStateException
it becomes clear:
Signals that a method has been invoked at an illegal or inappropriate time.That is not the case, it was fine to invoke the method here, but something inside the method went wrong, due to a program bug.