Have you tried changing
var roles: Set<RoleType>? = null
to
var roles: MutableSet<RoleType>? = null
If you have a look at the interface definition of Set, you’ll see it’s defined as public interface Set<out E> : Collection<E> whereas MutableSet is defined as public interface MutableSet<E> : Set<E>, MutableCollection<E>
Set<out E> ‘s Java equivalent I believe is Set<? extends E> instead of what you were looking for Set<E>.