The warning is : `Kotlin: Unchecked cast: Array&lt...
# announcements
t
The warning is :
Kotlin: Unchecked cast: Array<out Validator> to Array<Validator>
g
You could change
validators
type to
Array<out Validator>
. Or just merge that field with constructor parameter.
Copy code
class GenericCompositeValidator<T>(private val type: Class<T>,
                                   private vararg val validators: Validator) : Validator {

    override fun supports(clazz: Class<*>): Boolean = type.isAssignableFrom(clazz)

    override fun validate(target: Any, errors: Errors) {
        for (v in validators) {
            v.validate(target, errors)
        }
    }
}
t
thanks
that works 👍