int (@Nullable GrExpression exp) { if (exp instanceof GrLiteral) { return LITERAL_EXPRESSION; } if (exp instanceof GrReferenceExpression) { return REFERENCE_EXPRESSION; } if (exp instanceof GrTypeCastExpression) { return TYPE_CAST_EXPRESSION; } if (exp instanceof GrSafeCastExpression) { return SAFE_CAST_EXPRESSION; } if (exp instanceof GrInstanceOfExpression) { return INSTANCEOF_EXPRESSION; } if (exp instanceof GrNewExpression) { return NEW_EXPRESSION; } if (exp instanceof GrMethodCall) { return CALL_EXPRESSION; } if (exp instanceof GrUnaryExpression) { return ((GrUnaryExpression)exp).isPostfix() ? POSTFIX_EXPRESSION : PREFIX_EXPRESSION; } if (exp instanceof GrAssignmentExpression) { return ASSIGNMENT_EXPRESSION; } if (exp instanceof GrRangeExpression) { return RANGE_EXPRESSION; } if (exp instanceof GrBinaryExpression) { return BINARY_EXPRESSION; } if (exp instanceof GrElvisExpression) { return ELVIS_EXPRESSION; } if (exp instanceof GrConditionalExpression) { return CONDITIONAL_EXPRESSION; } if (exp instanceof GrIndexProperty) { return INDEX_EXPRESSION; } if (exp instanceof GrListOrMap) { return LIST_OR_MAP_EXPRESSION; } if (exp instanceof GrClosableBlock) { return CLOSABLE_BLOCK_EXPRESSION; } return -1; // Type of expression can be defined in third party plugins. See issue #IDEA-59846 }