void (@NotNull PsiElement element) { final PsiElement parent = element.getParent(); if (!(parent instanceof PsiVariable variable)) { return; } final PsiExpression initializer = variable.getInitializer(); if (initializer == null) { return; } final PsiType type = initializer.getType(); if (type == null) { return; } final PsiElementFactory factory = JavaPsiFacade.getElementFactory(element.getProject()); final PsiTypeElement typeElement = factory.createTypeElement(type); final PsiTypeElement variableTypeElement = variable.getTypeElement(); if (variableTypeElement == null) { return; } new CommentTracker().replaceAndRestoreComments(variableTypeElement, typeElement); }