void (@NotNull PsiDeclarationStatement statement) { super.visitDeclarationStatement(statement); final PsiElement[] declaredElements = statement.getDeclaredElements(); if (declaredElements.length == 0) { return; } for (PsiElement declaredElement : declaredElements) { if (!(declaredElement instanceof PsiLocalVariable variable)) { return; } final PsiElement context = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class, true, PsiClass.class); if (!isReplaceableStringBuffer(variable, context)) { return; } } final PsiLocalVariable firstVariable = (PsiLocalVariable)declaredElements[0]; registerVariableError(firstVariable); }