IPP: add GenericsUtil.getVariableTypeByExpressionType() call to be sure

This commit is contained in:
Bas Leijdekkers
2017-01-20 16:39:38 +01:00
parent 7ca2c6e59c
commit 9c665ddce5
@@ -158,7 +158,7 @@ public class ReplaceConditionalWithIfIntention extends Intention {
@Nullable PsiExpression replacementExpression, boolean insertCast, @NotNull StringBuilder out) {
if (element.equals(elementToReplace)) {
final String replacementText = (replacementExpression == null) ? "" : replacementExpression.getText();
final PsiType type = ExpectedTypeUtils.findExpectedType(elementToReplace, true);
final PsiType type = GenericsUtil.getVariableTypeByExpressionType(ExpectedTypeUtils.findExpectedType(elementToReplace, true));
if (insertCast && type != null) {
out.append('(').append(type.getCanonicalText()).append(')');
}