Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation is wrong about immutability #965

Open
DarioViva42 opened this issue Sep 2, 2024 · 0 comments · May be fixed by #974
Open

Documentation is wrong about immutability #965

DarioViva42 opened this issue Sep 2, 2024 · 0 comments · May be fixed by #974

Comments

@DarioViva42
Copy link

DarioViva42 commented Sep 2, 2024

public static <T> Set<T> asSet(Collection<T> c) {

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

atanasg added a commit to atanasg/jjwt that referenced this issue Oct 31, 2024
@atanasg atanasg linked a pull request Oct 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant