jwtk / jjwt

Java JWT: JSON Web Token for Java and Android
Apache License 2.0
10.33k stars 1.34k forks source link

Documentation is wrong about immutability #965

Open DarioViva42 opened 2 months ago

DarioViva42 commented 2 months ago

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.

@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