From b3a708b86e7be9468d92f74cb4e480730b671d76 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Mon, 8 Jan 2018 18:52:51 +0700 Subject: [PATCH] IDEA-184554 IncorrectOperationException from WrapWithAdapterMethodCallFix Reproducible only if 'Good code is red' inspection from DevKit is switched on --- .../daemon/impl/quickfix/WrapWithAdapterMethodCallFix.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapWithAdapterMethodCallFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapWithAdapterMethodCallFix.java index 4dc8f321ff34..3f3e41b42094 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapWithAdapterMethodCallFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapWithAdapterMethodCallFix.java @@ -68,6 +68,8 @@ public class WrapWithAdapterMethodCallFix extends LocalQuickFixAndIntentionActio if (LambdaUtil.notInferredType(variableType)) return false; String typeText = variableType.getCanonicalText(); + // Empty text can be generated by PsiImmediateClassType if unresolved anonymous class is created like new X() {} + if (typeText.isEmpty()) return false; PsiExpression replacement; try { replacement = createReplacement(context, "((" + typeText + ")null)");