Check Requirement.rule on init

This commit is contained in:
Him188 2020-11-12 10:06:51 +08:00
parent 1657fbd5ac
commit 52eaf56e5a

View File

@ -94,6 +94,14 @@ internal constructor(
*/ */
val rule: String, val rule: String,
) { ) {
init {
kotlin.runCatching {
parseRangeRequirement(rule)
}.onFailure {
throw java.lang.IllegalArgumentException("Syntax error: $rule", it)
}
}
@Transient @Transient
private val impl = SemVersionInternal.parseRangeRequirement(rule) private val impl = SemVersionInternal.parseRangeRequirement(rule)