This commit is contained in:
Bas Leijdekkers
2012-05-24 15:42:37 +02:00
parent f9a25a44b5
commit 2487bf48d3
2 changed files with 3 additions and 4 deletions
@@ -32,8 +32,7 @@ class ConstantExpressionPredicate implements PsiElementPredicate {
}
final PsiPolyadicExpression expression = (PsiPolyadicExpression)element;
final PsiType expressionType = expression.getType();
if (expressionType == null) return false;
if (expressionType.equalsToText("java.lang.String")) {
if (expressionType == null || expressionType.equalsToText("java.lang.String")) {
// intention disabled for string concatenations because of performance issues on
// relatively common large string expressions.
return false;
@@ -73,10 +73,10 @@ class ConstantSubexpressionPredicate implements PsiElementPredicate {
if (currentToken == token) {
final String binaryExpressionText = operands[i - 1].getText() + ' ' + token.getText() + ' ' + operand.getText();
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(expression.getProject());
return (PsiBinaryExpression)factory.createExpressionFromText(binaryExpressionText, expression);
return (PsiPolyadicExpression)factory.createExpressionFromText(binaryExpressionText, expression);
}
}
return null;
throw new AssertionError();
}
private static boolean isPartOfLargerExpression(PsiPolyadicExpression expression) {