From fd653d3adea2a6ec2d2e7c485ef33add4b4937f8 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Mon, 28 Aug 2017 10:07:34 +0700 Subject: [PATCH] WrapWithAdapterMethodCallFix use variable type for cast Fixes failing GenericsHighlightingTest.testIDEA124019 --- .../daemon/impl/quickfix/WrapWithAdapterMethodCallFix.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 99e2f6ed6230..1cc0f9b3ea24 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 @@ -61,7 +61,8 @@ public class WrapWithAdapterMethodCallFix extends LocalQuickFixAndIntentionActio !myOutTypeFilter.test(outType)) { return false; } - PsiType resultType = createReplacement(context, "((" + inType.getCanonicalText() + ")null)").getType(); + PsiType resultType = + createReplacement(context, "((" + GenericsUtil.getVariableTypeByExpressionType(inType).getCanonicalText() + ")null)").getType(); return resultType != null && outType.isAssignableFrom(resultType); }