EA-39088 - IAE: CompositePsiElement.replace

This commit is contained in:
Anna Kozlova
2012-09-11 14:18:42 +04:00
parent 14100e84e2
commit 29331a04f4
@@ -83,6 +83,9 @@ public class AddTypeCastFix extends LocalQuickFixAndIntentionActionOnPsiElement
static PsiExpression createCastExpression(PsiExpression originalExpression, Project project, PsiType type) throws IncorrectOperationException {
// remove nested casts
PsiElement element = PsiUtil.deparenthesizeExpression(originalExpression);
if (element == null){
return null;
}
PsiElementFactory factory = JavaPsiFacade.getInstance(originalExpression.getProject()).getElementFactory();
PsiTypeCastExpression typeCast = (PsiTypeCastExpression)factory.createExpressionFromText("(Type)value", null);