void (@NotNull PsiLocalVariable variable, @NotNull HighlightInfo.Builder info) { PsiElement block = PsiUtil.getVariableCodeBlock(variable, null); if (block == null) return; PsiTreeUtil.processElements(block, PsiReferenceExpression.class, ref -> { if (ref.isReferenceTo(variable)) { PsiAssignmentExpression assignment = ObjectUtils.tryCast(ref.getParent(), PsiAssignmentExpression.class); if (assignment != null) { if (assignment.getLExpression() == ref && assignment.getOperationTokenType() == JavaTokenType.EQ) { PsiExpression rExpression = assignment.getRExpression(); if (rExpression != null) { PsiType type = rExpression.getType(); if (type instanceof PsiPrimitiveType && !PsiTypes.voidType().equals(type) && variable.getInitializer() != null) { type = ((PsiPrimitiveType)type).getBoxedType(variable); } if (type != null) { type = GenericsUtil.getVariableTypeByExpressionType(type); if (PsiTypesUtil.isDenotableType(type, variable) && !PsiTypes.voidType().equals(type)) { IntentionAction fix = QuickFixFactory.getInstance().createSetVariableTypeFix(variable, type); info.registerFix(fix, null, null, null, null); } return false; } } } } } return true; }); }