mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 13:39:36 +07:00
New level 'MUST_NOT_MODIFY' is introduced for parameters inside pure methods to signal that we should not modify these values, but we don't actually know whether they mutable or not (fixes IDEA-257286). Also, MUST_NOT_MODIFY is dropped inside nested closures, so we don't warn if parameter is modified there. GitOrigin-RevId: f095e72be772eef8324ef2246fb0b7262beae20d
17 lines
439 B
Java
17 lines
439 B
Java
// "Fix all 'Redundant usage of unmodifiable collection wrappers' problems in file" "false"
|
|
|
|
import java.util.*;
|
|
import org.jetbrains.annotations.Contract;
|
|
|
|
class Main {
|
|
|
|
@Contract(pure = true)
|
|
public static <T> List<T> unmodifiableOrEmptyList(List<? extends T> original) {
|
|
int size = original.size();
|
|
if (size == 0) {
|
|
return Collections.emptyList();
|
|
}
|
|
return Collections.<caret>unmodifiableList(original);
|
|
}
|
|
}
|