-
Notifications
You must be signed in to change notification settings - Fork 920
Closed as not planned
Labels
Java[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)hintskind:featureA feature requestA feature request
Description
Description
it would be good to have hints showing some warning message("mutable method xyz cannot be used on immutable collection") when immutable collections are used with mutable methods.
example:
var immutableList = List.of(10,20);
immutableList.add(20);
var immutableList = List.of(10,20);
immutableList.remove(20);
- below are the methods which ImmutableCollections.AbstractImmutableList has below operations which throws UnsupportedOperationException
@Override public boolean add(E e) { throw uoe(); } @Override public boolean addAll(Collection<? extends E> c) { throw uoe(); } @Override public void clear() { throw uoe(); } @Override public boolean remove(Object o) { throw uoe(); } @Override public boolean removeAll(Collection<?> c) { throw uoe(); } @Override public boolean removeIf(Predicate<? super E> filter) { throw uoe(); } @Override public boolean retainAll(Collection<?> c) { throw uoe(); } - at the moment no hint is shown


Use case/motivation
No response
Related issues
related issue JVSCE-361
Are you willing to submit a pull request?
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Java[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)hintskind:featureA feature requestA feature request