private static boolean isCastNeeded(PsiType target, GrExpression initializer, ExpressionContext expressionContext) {
    if (target == null) return false;
    final PsiType iType = getDeclaredType(initializer, expressionContext);
    if (iType == null) return false;
    if (TypeConversionUtil.isAssignable(target, iType)) return false;

    if (initializer instanceof GrLiteral) {
      Object value = ((GrLiteral)initializer).getValue();
      if (value instanceof BigDecimal && Double.isFinite(((BigDecimal)value).doubleValue())) {
        return !TypeConversionUtil.isAssignable(target, PsiTypes.doubleType());
      }
      else if (value instanceof String && ((String)value).length() == 1) {
        return !PsiTypes.charType().equals(PsiPrimitiveType.getOptionallyUnboxedType(target));
      }
    }
    else if (initializer instanceof GrListOrMap listOrMap && target instanceof PsiArrayType) {
      return listOrMap.isMap();
    }
    return true;
  }
private static boolean isCastNeeded(PsiType target, GrExpression initializer, ExpressionContext expressionContext)