@NotNull
  private static DfaValue getAdvancedExpressionDfaValue(@NotNull DfaValueFactory factory,
                                                        @Nullable PsiExpression expression,
                                                        @NotNull DfType targetType) {
    if (expression == null) return factory.getUnknown();
    DfaValue value = JavaDfaValueFactory.getExpressionDfaValue(factory, expression);
    if (value != null) {
      if (value instanceof DfaVariableValue) {
        value = factory.fromDfType(value.getDfType());
      }
      return DfaUtil.boxUnbox(value, targetType);
    }
    if (expression instanceof PsiConditionalExpression) {
      return getAdvancedExpressionDfaValue(factory, ((PsiConditionalExpression)expression).getThenExpression(), targetType).unite(
        getAdvancedExpressionDfaValue(factory, ((PsiConditionalExpression)expression).getElseExpression(), targetType));
    }
    PsiType type = expression.getType();
    if (expression instanceof PsiArrayInitializerExpression) {
      int length = ((PsiArrayInitializerExpression)expression).getInitializers().length;
      return factory.fromDfType(SpecialField.ARRAY_LENGTH.asDfType(DfTypes.intValue(length))
                                  .meet(DfTypes.typedObject(type, Nullability.NOT_NULL)));
    }
    DfType dfType = DfTypes.typedObject(type, NullabilityUtil.getExpressionNullability(expression));
    if (dfType instanceof DfPrimitiveType && targetType instanceof DfPrimitiveType && dfType.meet(targetType) == DfType.BOTTOM) {
      if (targetType instanceof DfIntegralType) {
        if (targetType instanceof DfLongType) return factory.fromDfType(((DfPrimitiveType)dfType).castTo(PsiTypes.longType()));
      }
      return factory.fromDfType(targetType);
    }
    return DfaUtil.boxUnbox(factory.fromDfType(dfType), targetType);
  }
@NotNull
  private static DfaValue getAdvancedExpressionDfaValue(@NotNull DfaValueFactory factory,
                                                        @Nullable PsiExpression expression,
                                                        @NotNull DfType targetType)