From 9629bb5f5d5e08f0723234e994cd8950a8232f9b Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 17 Dec 2021 14:58:31 +0100 Subject: [PATCH] [redundant throws] fix another race condition GitOrigin-RevId: 3aac8e3c0e760f75307eb4260b09000546ce1665 --- .../codeInspection/reference/RefMethodImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java index a5871889314b..d2597d2412cb 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInspection.reference; import com.intellij.lang.java.JavaLanguage; @@ -608,9 +608,12 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod { public void updateThrowsList(PsiClassType exceptionType) { LOG.assertTrue(isInitialized()); - for (RefMethod refSuper : getSuperMethods()) { - ((RefMethodImpl)refSuper).updateThrowsList(exceptionType); - } + myManager.executeTask(() -> { + for (RefMethod refSuper : getSuperMethods()) { + refSuper.waitForInitialized(); + ((RefMethodImpl)refSuper).updateThrowsList(exceptionType); + } + }); synchronized (this) { List unThrownExceptions = myUnThrownExceptions; if (unThrownExceptions != null) {