From f948bc1282a211f63bedb64d0b88816dc0373154 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Sat, 9 Aug 2025 18:43:10 +0200 Subject: [PATCH] Java: avoid IAE from CommonProblemDescriptorImpl during property tests GitOrigin-RevId: 95ef2d4e42e7de9be6790fef00e6bb32656101af --- .../codeInspection/dataFlow/DataFlowInspectionBase.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java index df5f614e7c0c..718da87968d4 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java @@ -1,5 +1,4 @@ -// Copyright 2000-2024 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.codeInspection.dataFlow; import com.intellij.codeInsight.*; @@ -799,8 +798,8 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec List fixes = createNPEFixes(expr, expr, reporter.isOnTheFly(), exactlyNull); PsiMethod surroundingMethod = PsiTreeUtil.getParentOfType(anchor, PsiMethod.class, true, PsiLambdaExpression.class); if (surroundingMethod != null) { - LocalQuickFix fix = LocalQuickFix.from(AddAnnotationModCommandAction.createAddNullableFix(surroundingMethod)); - fixes = StreamEx.of(fixes).append(fix).toList(); + ModCommandAction fix = AddAnnotationModCommandAction.createAddNullableFix(surroundingMethod); + if (fix != null) fixes = StreamEx.of(fixes).append(LocalQuickFix.from(fix)).toList(); } reporter.registerProblem(expr, text, fixes.toArray(LocalQuickFix.EMPTY_ARRAY)); }