public static @Nullable String getEffectiveInitializerText(@NotNull PsiPatternVariable variable) {
    PsiPattern pattern = variable.getPattern();
    PsiInstanceOfExpression instanceOf = ObjectUtils.tryCast(pattern.getParent(), PsiInstanceOfExpression.class);
    if (instanceOf == null) return null;
    PsiExpression operand = instanceOf.getOperand();
    PsiTypeElement checkType;
    if (pattern instanceof PsiTypeTestPattern) {
      checkType = ((PsiTypeTestPattern)pattern).getCheckType();
    }
    else if (pattern instanceof PsiDeconstructionPattern) {
      checkType = ((PsiDeconstructionPattern)pattern).getTypeElement();
    }
    else {
      checkType = null;
    }
    if (checkType == null) return null;
    if (checkType.getType().equals(operand.getType())) {
      return operand.getText();
    }
    return "(" + checkType.getText() + ")" + operand.getText();
  }
public static @Nullable String getEffectiveInitializerText(@NotNull PsiPatternVariable variable)