czyzby
04/25/2020, 9:33 AMOptIn
annotation or compiler flags? Should I annotate my methods/files with @OptIn(ExperimentalContracts::class)
?Animesh Sahu
04/25/2020, 10:51 AMcompileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions {
freeCompilerArgs = ["-Xopt-in=kotlin.contracts.ExperimentalContracts"]
}
}
Animesh Sahu
04/25/2020, 10:53 AMczyzby
04/25/2020, 11:24 AMAnimesh Sahu
04/25/2020, 11:39 AMczyzby
04/25/2020, 12:08 PMOptIn
seems to do exactly that. Notice how stdlib utilities such as apply
or let
use contracts, but do not propagate the warnings.
Since there are no major changes planned in 1.4 (at least in the parts of the contracts that I'm using), I think I prefer ease of setup over excessive warnings and "what-if" situations.Zach Klippenstein (he/him) [MOD]
04/25/2020, 6:52 PMczyzby
04/26/2020, 9:56 AM@OptIn(ExpertimentalContracts::class)
, making the contracts usage easy for the library users - they do not have to use any annotations or compiler flags. Thanks for your input guys.dmitriy.novozhilov
04/28/2020, 8:07 AM