@NotNull
  public VariableData substitute(@Nullable PsiVariable var) {
    if (var == null) {
      return this;
    }
    // The copied type needs to be valid in a non-physical copy of the original file.
    // If the type references a type variable declared in the original file, it might not work in the copy.
    PsiType type = this.type instanceof PsiImmediateClassType && ((PsiImmediateClassType)this.type).resolve() instanceof PsiTypeParameter
                   ? JavaPsiFacade.getElementFactory(var.getProject()).createTypeFromText(this.type.getCanonicalText(), var)
                   : this.type;
    VariableData data = new VariableData(var, type);
    data.name = this.name;
    data.originalName = this.originalName;
    data.passAsParameter = this.passAsParameter;
    return data;
  }
@NotNull
  public VariableData substitute(@Nullable PsiVariable var)