From 499e8b72cfd5d2c4554e552a01759db07d3c285b Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 25 Nov 2024 17:00:42 +0100 Subject: [PATCH] warn about immutable lists passed to setItems() GitOrigin-RevId: a70b45cb5674ce15543f96be8d55c56bdd469208 --- .../platform-api/src/com/intellij/util/ui/TableViewModel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java b/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java index d86fda76f542..e71dcfb320c2 100644 --- a/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java +++ b/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java @@ -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 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 items); + @Unmodifiable public abstract @NotNull List getItems(); } \ No newline at end of file