Pattern (@NotNull PsiRecordComponent recordComponent, @NotNull PsiElement context) { JavaCodeStyleManager manager = JavaCodeStyleManager.getInstance(context.getProject()); String name = manager.suggestUniqueVariableName(recordComponent.getName(), context, true); PsiType type = recordComponent.getType(); if (type instanceof PsiClassType classType && classType.resolve() instanceof PsiTypeParameter) { return new Pattern("var", name); } return new Pattern(type.getCanonicalText(), name); }