warn about immutable lists passed to setItems()

GitOrigin-RevId: a70b45cb5674ce15543f96be8d55c56bdd469208
This commit is contained in:
Alexey Kudravtsev
2024-11-26 16:58:17 +00:00
committed by intellij-monorepo-bot
parent f1d078e660
commit 499e8b72cf
@@ -1,7 +1,9 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.util.ui;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
import javax.swing.table.AbstractTableModel;
import java.util.List;
@@ -11,6 +13,8 @@ public abstract class TableViewModel<Item> extends AbstractTableModel implements
* Set the model source data to make UI show the data from this list
* @param items must be mutable to be able to accommodate the changes from UI
*/
@Contract(mutates = "param1")
public abstract void setItems(@NotNull List<Item> items);
@Unmodifiable
public abstract @NotNull List<Item> getItems();
}