void (final @NotNull PsiExpression expression) { super.visitExpression(expression); final PsiType type = expression.getType(); if (type != null) { final PsiTypesUtil.TypeParameterSearcher searcher = new PsiTypesUtil.TypeParameterSearcher(); type.accept(searcher); for (PsiTypeParameter typeParam : searcher.getTypeParameters()) { if (PsiTreeUtil.isAncestor(typeParam.getOwner(), element, false) && filter.value(typeParam)){ used.add(typeParam); } } } }