From 86117c23cd673ddf7b6dd9bcc38bb34ad22a233c Mon Sep 17 00:00:00 2001 From: Konstantin Nisht Date: Mon, 8 Dec 2025 15:47:36 +0100 Subject: [PATCH] [threading] IJPL-222254: Fix read access in MoveInstanceMethodDialogBase GitOrigin-RevId: 2a750ee2231794bbe4ac31d2155961e35c6843ac --- .../MoveInstanceMethodDialogBase.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java index 62048803af39..9cb777ebcad7 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveInstanceMethod/MoveInstanceMethodDialogBase.java @@ -1,8 +1,9 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.move.moveInstanceMethod; import com.intellij.java.refactoring.JavaRefactoringBundle; import com.intellij.lang.findUsages.DescriptiveNameUtil; +import com.intellij.openapi.application.WriteIntentReadAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.NlsContexts; @@ -137,11 +138,13 @@ public abstract class MoveInstanceMethodDialogBase extends MoveDialogBase { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value instanceof PsiVariable psiVariable) { - final String text = PsiFormatUtil.formatVariable(psiVariable, - PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE, - PsiSubstitutor.EMPTY); - setIcon(psiVariable.getIcon(0)); - setText(text); + WriteIntentReadAction.run(() -> { + final String text = PsiFormatUtil.formatVariable(psiVariable, + PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE, + PsiSubstitutor.EMPTY); + setIcon(psiVariable.getIcon(0)); + setText(text); + }); } else if (value instanceof @NlsSafe String s) { setText(s);