You tell users, that asSet returns an immutable Set.
@return a type-safe immutable {@code Set} containing the specified collection elements.
This is not true, when you pass in a mutable Set. In this case the Collection is only cast to a Set. You probably want to change the documentation or use java.util.Collections.unmodifiableSet
https://github.com/jwtk/jjwt/blob/5812f63a76084914c5b653025bd3b84048389223/api/src/main/java/io/jsonwebtoken/lang/Collections.java#L94
You tell users, that asSet returns an immutable
Set
.This is not true, when you pass in a mutable
Set
. In this case theCollection
is only cast to aSet
. You probably want to change the documentation or usejava.util.Collections.unmodifiableSet