From e282a134ca14780870433eb9a541a71875ca164c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Millon?= Date: Wed, 11 Sep 2019 14:35:55 +0200 Subject: [PATCH] Move interfaces back to Java to avoid -Xjvm-default compiler arg --- jcv-assertj/build.gradle.kts | 1 - jcv-core/build.gradle.kts | 1 - .../oss/jcv/core/JsonContextMatcher.java | 24 ++++++++++ .../ekino/oss/jcv/core/JsonValidator.java} | 10 ++-- .../oss/jcv/core/JsonValueComparator.java | 32 +++++++++++++ .../NoParameterComparatorInitializer.java | 24 ++++++++++ .../OneParameterComparatorInitializer.java | 26 ++++++++++ .../TemplatedComparatorInitializer.java} | 10 ++-- .../TwoParametersComparatorInitializer.java} | 8 ++-- .../ekino/oss/jcv/core/JsonContextMatcher.kt | 24 ---------- .../ekino/oss/jcv/core/JsonValueComparator.kt | 32 ------------- .../oss/jcv/core/initializer/Initializers.kt | 47 +++++++------------ .../NoParameterComparatorInitializer.kt | 22 +-------- .../OneParameterComparatorInitializer.kt | 24 +--------- .../core/validator/DefaultJsonValidator.kt | 10 ++-- .../DefaultValueTemplateIdValidator.kt | 3 +- .../ValueParameterizedTemplateValidator.kt | 11 ++--- .../validator/ValueTemplateIdValidator.kt | 3 +- jcv-hamcrest/build.gradle.kts | 1 - 19 files changed, 154 insertions(+), 159 deletions(-) create mode 100644 jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonContextMatcher.java rename jcv-core/src/main/{kotlin/com/ekino/oss/jcv/core/JsonValidator.kt => java/com/ekino/oss/jcv/core/JsonValidator.java} (64%) create mode 100644 jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonValueComparator.java create mode 100644 jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.java create mode 100644 jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.java rename jcv-core/src/main/{kotlin/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.kt => java/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.java} (67%) rename jcv-core/src/main/{kotlin/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.kt => java/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.java} (70%) delete mode 100644 jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonContextMatcher.kt delete mode 100644 jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonValueComparator.kt diff --git a/jcv-assertj/build.gradle.kts b/jcv-assertj/build.gradle.kts index 3ca0808..dc96039 100644 --- a/jcv-assertj/build.gradle.kts +++ b/jcv-assertj/build.gradle.kts @@ -30,7 +30,6 @@ val javadocJar by tasks.registering(Jar::class) { tasks { withType { kotlinOptions { - freeCompilerArgs = listOf("-Xjvm-default=compatibility") jvmTarget = JavaVersion.VERSION_1_8.toString() } } diff --git a/jcv-core/build.gradle.kts b/jcv-core/build.gradle.kts index 68f936e..778dc07 100644 --- a/jcv-core/build.gradle.kts +++ b/jcv-core/build.gradle.kts @@ -30,7 +30,6 @@ val javadocJar by tasks.registering(Jar::class) { tasks { withType { kotlinOptions { - freeCompilerArgs = listOf("-Xjvm-default=compatibility") jvmTarget = JavaVersion.VERSION_1_8.toString() } } diff --git a/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonContextMatcher.java b/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonContextMatcher.java new file mode 100644 index 0000000..3f51d7a --- /dev/null +++ b/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonContextMatcher.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 ekino (https://www.ekino.com/) + */ +package com.ekino.oss.jcv.core; + +/** + * Matcher used to identify a specific field. + * + * @author Leo Millon + */ +@FunctionalInterface +public interface JsonContextMatcher { + + /** + * Evaluates the current json parsing context. + * + * @param prefix the current json field path + * @param expectedValue the expected field value + * @param actualValue the actual field value + * + * @return {@code true} if the context matches, otherwise {@code false} + */ + boolean matches(String prefix, Object expectedValue, Object actualValue); +} diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonValidator.kt b/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonValidator.java similarity index 64% rename from jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonValidator.kt rename to jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonValidator.java index dd8ab3f..421a031 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonValidator.kt +++ b/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonValidator.java @@ -1,9 +1,9 @@ /* * Copyright (c) 2019 ekino (https://www.ekino.com/) */ -package com.ekino.oss.jcv.core +package com.ekino.oss.jcv.core; -import org.skyscreamer.jsonassert.ValueMatcher +import org.skyscreamer.jsonassert.ValueMatcher; /** * A validator composed of a matcher and a value comparator. @@ -12,19 +12,19 @@ * * @author Leo Millon */ -interface JsonValidator { +public interface JsonValidator { /** * The context matcher. * * @return the matcher */ - val contextMatcher: JsonContextMatcher + JsonContextMatcher getContextMatcher(); /** * The field value comparator. * * @return the comparator */ - val valueComparator: ValueMatcher + ValueMatcher getValueComparator(); } diff --git a/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonValueComparator.java b/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonValueComparator.java new file mode 100644 index 0000000..7ec1900 --- /dev/null +++ b/jcv-core/src/main/java/com/ekino/oss/jcv/core/JsonValueComparator.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019 ekino (https://www.ekino.com/) + */ +package com.ekino.oss.jcv.core; + +import org.skyscreamer.jsonassert.ValueMatcher; + +/** + * A JSON value comparator. + * + * @param the field value type + * + * @author Leo Millon + */ +@FunctionalInterface +public interface JsonValueComparator extends ValueMatcher { + + @Override + default boolean equal(T o1, T o2) { + return hasCorrectValue(o1, o2); + } + + /** + * Evaluates actual field value against the expected one. + * + * @param actual field actual value + * @param expected field expected value + * + * @return {@code true} if the actual is valid against the expected one, otherwise {@code false} + */ + boolean hasCorrectValue(T actual, T expected); +} diff --git a/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.java b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.java new file mode 100644 index 0000000..b1995f5 --- /dev/null +++ b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 ekino (https://www.ekino.com/) + */ +package com.ekino.oss.jcv.core.initializer; + +import org.skyscreamer.jsonassert.ValueMatcher; + +/** + * Comparator intializer. + * + * @param the field value type + * + * @author Leo Millon + */ +@FunctionalInterface +public interface NoParameterComparatorInitializer { + + /** + * Init a comparator without template parameter. + * + * @return the initalized comparator + */ + ValueMatcher initComparator(); +} diff --git a/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.java b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.java new file mode 100644 index 0000000..74b104c --- /dev/null +++ b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2019 ekino (https://www.ekino.com/) + */ +package com.ekino.oss.jcv.core.initializer; + +import org.skyscreamer.jsonassert.ValueMatcher; + +/** + * Comparator intializer given tempated validator with 1 parameter information. + * + * @param the field value type + * + * @author Leo Millon + */ +@FunctionalInterface +public interface OneParameterComparatorInitializer { + + /** + * Init a comparator using the current templated validator info. + * + * @param parameter the first parameter of the templated validator + * + * @return the initalized comparator + */ + ValueMatcher initComparator(String parameter); +} diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.kt b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.java similarity index 67% rename from jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.kt rename to jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.java index aa9cac4..bf8bce0 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.kt +++ b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/TemplatedComparatorInitializer.java @@ -1,10 +1,10 @@ /* * Copyright (c) 2019 ekino (https://www.ekino.com/) */ -package com.ekino.oss.jcv.core.initializer +package com.ekino.oss.jcv.core.initializer; -import com.ekino.oss.jcv.core.validator.ValidatorTemplateManager -import org.skyscreamer.jsonassert.ValueMatcher +import com.ekino.oss.jcv.core.validator.ValidatorTemplateManager; +import org.skyscreamer.jsonassert.ValueMatcher; /** * Comparator intializer given tempated validator information. @@ -14,7 +14,7 @@ * @author Leo Millon */ @FunctionalInterface -interface TemplatedComparatorInitializer { +public interface TemplatedComparatorInitializer { /** * Init a comparator using the current templated validator info. @@ -23,5 +23,5 @@ interface TemplatedComparatorInitializer { * * @return the initalized comparator */ - fun initComparator(validatorTemplateManager: ValidatorTemplateManager): ValueMatcher + ValueMatcher initComparator(ValidatorTemplateManager validatorTemplateManager); } diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.kt b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.java similarity index 70% rename from jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.kt rename to jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.java index 679882f..8377e46 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.kt +++ b/jcv-core/src/main/java/com/ekino/oss/jcv/core/initializer/TwoParametersComparatorInitializer.java @@ -1,9 +1,9 @@ /* * Copyright (c) 2019 ekino (https://www.ekino.com/) */ -package com.ekino.oss.jcv.core.initializer +package com.ekino.oss.jcv.core.initializer; -import org.skyscreamer.jsonassert.ValueMatcher +import org.skyscreamer.jsonassert.ValueMatcher; /** * Comparator intializer given tempated validator with 2 parameters information. @@ -13,7 +13,7 @@ * @author Leo Millon */ @FunctionalInterface -interface TwoParametersComparatorInitializer { +public interface TwoParametersComparatorInitializer { /** * Init a comparator using the current templated validator info. @@ -23,5 +23,5 @@ interface TwoParametersComparatorInitializer { * * @return the initalized comparator */ - fun initComparator(param1: String?, param2: String?): ValueMatcher + ValueMatcher initComparator(String param1, String param2); } diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonContextMatcher.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonContextMatcher.kt deleted file mode 100644 index c0fe6dc..0000000 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonContextMatcher.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2019 ekino (https://www.ekino.com/) - */ -package com.ekino.oss.jcv.core - -/** - * Matcher used to identify a specific field. - * - * @author Leo Millon - */ -@FunctionalInterface -interface JsonContextMatcher { - - /** - * Evaluates the current json parsing context. - * - * @param prefix the current json field path - * @param expectedValue the expected field value - * @param actualValue the actual field value - * - * @return `true` if the context matches, otherwise `false` - */ - fun matches(prefix: String, expectedValue: Any?, actualValue: Any?): Boolean -} diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonValueComparator.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonValueComparator.kt deleted file mode 100644 index 00c85c8..0000000 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/JsonValueComparator.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019 ekino (https://www.ekino.com/) - */ -package com.ekino.oss.jcv.core - -import org.skyscreamer.jsonassert.ValueMatcher - -/** - * A JSON value comparator. - * - * @param the field value type - * - * @author Leo Millon - */ -@FunctionalInterface -interface JsonValueComparator : ValueMatcher { - - @JvmDefault - override fun equal(o1: T?, o2: T?): Boolean { - return hasCorrectValue(o1, o2) - } - - /** - * Evaluates actual field value against the expected one. - * - * @param actual field actual value - * @param expected field expected value - * - * @return `true` if the actual is valid against the expected one, otherwise `false` - */ - fun hasCorrectValue(actual: T?, expected: T?): Boolean -} diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/Initializers.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/Initializers.kt index 9806a0e..e305722 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/Initializers.kt +++ b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/Initializers.kt @@ -28,10 +28,7 @@ object Initializers { @JvmStatic fun comparatorWithoutParameter(initializer: NoParameterComparatorInitializer): TemplatedComparatorInitializer = - object : TemplatedComparatorInitializer { - override fun initComparator(validatorTemplateManager: ValidatorTemplateManager): ValueMatcher = - initializer.initComparator() - } + TemplatedComparatorInitializer { initializer.initComparator() } @JvmStatic @JvmOverloads @@ -39,11 +36,9 @@ object Initializers { required: Boolean = true, initializer: OneParameterComparatorInitializer ): TemplatedComparatorInitializer = - object : TemplatedComparatorInitializer { - override fun initComparator(validatorTemplateManager: ValidatorTemplateManager): ValueMatcher { - val parameter = getOrThrowParameter(0, required, validatorTemplateManager) - return initializer.initComparator(parameter) - } + TemplatedComparatorInitializer { validatorTemplateManager -> + val parameter = getOrThrowParameter(0, required, validatorTemplateManager) + initializer.initComparator(parameter) } @JvmStatic @@ -52,12 +47,10 @@ object Initializers { param2Required: Boolean = true, initializer: TwoParametersComparatorInitializer ): TemplatedComparatorInitializer { - return object : TemplatedComparatorInitializer { - override fun initComparator(validatorTemplateManager: ValidatorTemplateManager): ValueMatcher { - val parameter1 = getOrThrowParameter(0, param1Required, validatorTemplateManager) - val parameter2 = getOrThrowParameter(1, param2Required, validatorTemplateManager) - return initializer.initComparator(parameter1, parameter2) - } + return TemplatedComparatorInitializer { validatorTemplateManager -> + val parameter1 = getOrThrowParameter(0, param1Required, validatorTemplateManager) + val parameter2 = getOrThrowParameter(1, param2Required, validatorTemplateManager) + initializer.initComparator(parameter1, parameter2) } } @@ -76,26 +69,22 @@ object Initializers { @JvmStatic @SafeVarargs fun allOf(vararg initializers: TemplatedComparatorInitializer): TemplatedComparatorInitializer = - object : TemplatedComparatorInitializer { - override fun initComparator(validatorTemplateManager: ValidatorTemplateManager): ValueMatcher { - return ValueMatcher { actual, expected -> - sequenceOf(*initializers) - .map { it.initComparator(validatorTemplateManager) } - .all { it.equal(actual, expected) } - } + TemplatedComparatorInitializer { validatorTemplateManager -> + ValueMatcher { actual, expected -> + sequenceOf(*initializers) + .map { it.initComparator(validatorTemplateManager) } + .all { it.equal(actual, expected) } } } @JvmStatic @SafeVarargs fun anyOf(vararg initializers: TemplatedComparatorInitializer): TemplatedComparatorInitializer = - object : TemplatedComparatorInitializer { - override fun initComparator(validatorTemplateManager: ValidatorTemplateManager): ValueMatcher { - return ValueMatcher { actual, expected -> - sequenceOf(*initializers) - .map { it.initComparator(validatorTemplateManager) } - .any { it.equal(actual, expected) } - } + TemplatedComparatorInitializer { validatorTemplateManager -> + ValueMatcher { actual, expected -> + sequenceOf(*initializers) + .map { it.initComparator(validatorTemplateManager) } + .any { it.equal(actual, expected) } } } } diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.kt index 55afd63..87ad104 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.kt +++ b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/NoParameterComparatorInitializer.kt @@ -5,27 +5,7 @@ package com.ekino.oss.jcv.core.initializer import org.skyscreamer.jsonassert.ValueMatcher -/** - * Comparator intializer. - * - * @param the field value type - * - * @author Leo Millon - */ -@FunctionalInterface -interface NoParameterComparatorInitializer { - - /** - * Init a comparator without template parameter. - * - * @return the initalized comparator - */ - fun initComparator(): ValueMatcher -} - typealias KNoParameterComparatorInitializer = () -> ValueMatcher fun asNoParameterComparatorInitializer(initializer: KNoParameterComparatorInitializer) = - object : NoParameterComparatorInitializer { - override fun initComparator(): ValueMatcher = initializer() - } + NoParameterComparatorInitializer { initializer() } diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.kt index b48daf6..57a942f 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.kt +++ b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/initializer/OneParameterComparatorInitializer.kt @@ -5,29 +5,7 @@ package com.ekino.oss.jcv.core.initializer import org.skyscreamer.jsonassert.ValueMatcher -/** - * Comparator intializer given tempated validator with 1 parameter information. - * - * @param the field value type - * - * @author Leo Millon - */ -@FunctionalInterface -interface OneParameterComparatorInitializer { - - /** - * Init a comparator using the current templated validator info. - * - * @param parameter the first parameter of the templated validator - * - * @return the initalized comparator - */ - fun initComparator(parameter: String?): ValueMatcher -} - typealias KOneParameterComparatorInitializer = (parameter: String?) -> ValueMatcher fun asOneParameterComparatorInitializer(initializer: KOneParameterComparatorInitializer) = - object : OneParameterComparatorInitializer { - override fun initComparator(parameter: String?): ValueMatcher = initializer(parameter) - } + OneParameterComparatorInitializer { parameter -> initializer(parameter) } diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultJsonValidator.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultJsonValidator.kt index 4701ad1..7e3651e 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultJsonValidator.kt +++ b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultJsonValidator.kt @@ -8,6 +8,10 @@ import com.ekino.oss.jcv.core.JsonValidator import org.skyscreamer.jsonassert.ValueMatcher internal class DefaultJsonValidator( - override val contextMatcher: JsonContextMatcher, - override val valueComparator: ValueMatcher -) : JsonValidator + private val contextMatcher: JsonContextMatcher, + private val valueComparator: ValueMatcher +) : JsonValidator { + override fun getContextMatcher(): JsonContextMatcher = contextMatcher + + override fun getValueComparator(): ValueMatcher = valueComparator +} diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultValueTemplateIdValidator.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultValueTemplateIdValidator.kt index 55f2265..c11ef9c 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultValueTemplateIdValidator.kt +++ b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/DefaultValueTemplateIdValidator.kt @@ -8,6 +8,5 @@ import org.skyscreamer.jsonassert.ValueMatcher internal class DefaultValueTemplateIdValidator(validatorId: String, private val comparator: ValueMatcher) : ValueTemplateIdValidator(validatorId) { - override val valueComparator: ValueMatcher - get() = comparator + override fun getValueComparator(): ValueMatcher = comparator } diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueParameterizedTemplateValidator.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueParameterizedTemplateValidator.kt index 194b5f6..dfd36e1 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueParameterizedTemplateValidator.kt +++ b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueParameterizedTemplateValidator.kt @@ -7,13 +7,12 @@ import org.skyscreamer.jsonassert.ValueMatcher abstract class ValueParameterizedTemplateValidator(validatorId: String) : ValueTemplateIdValidator(validatorId) { - override val valueComparator: ValueMatcher - get() = ValueMatcher { actual, expected -> - if (expected is String) { - return@ValueMatcher getValueComparator(ValidatorTemplateManager(expected)).equal(actual, expected) - } - throw IllegalArgumentException("Invalid template definition : $expected") + override fun getValueComparator(): ValueMatcher = ValueMatcher { actual, expected -> + if (expected is String) { + return@ValueMatcher getValueComparator(ValidatorTemplateManager(expected)).equal(actual, expected) } + throw IllegalArgumentException("Invalid template definition : $expected") + } protected abstract fun getValueComparator(validatorTemplateManager: ValidatorTemplateManager): ValueMatcher } diff --git a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueTemplateIdValidator.kt b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueTemplateIdValidator.kt index 693b012..8932e42 100644 --- a/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueTemplateIdValidator.kt +++ b/jcv-core/src/main/kotlin/com/ekino/oss/jcv/core/validator/ValueTemplateIdValidator.kt @@ -10,6 +10,5 @@ abstract class ValueTemplateIdValidator(validatorId: String) : JsonValidator< private val matcher: ValidatorIdInValueMatcher = ValidatorIdInValueMatcher(validatorId) - override val contextMatcher: JsonContextMatcher - get() = matcher + override fun getContextMatcher(): JsonContextMatcher = matcher } diff --git a/jcv-hamcrest/build.gradle.kts b/jcv-hamcrest/build.gradle.kts index 868d4b0..c0dd7f7 100644 --- a/jcv-hamcrest/build.gradle.kts +++ b/jcv-hamcrest/build.gradle.kts @@ -30,7 +30,6 @@ val javadocJar by tasks.registering(Jar::class) { tasks { withType { kotlinOptions { - freeCompilerArgs = listOf("-Xjvm-default=compatibility") jvmTarget = JavaVersion.VERSION_1_8.toString() } }