void () { JavaRecursiveElementWalkingVisitor visitor = new JavaRecursiveElementWalkingVisitor() { @Override public void visitExpression(@NotNull PsiExpression expression) { super.visitExpression(expression); if (expression.getUserData(PARAMETER) != null) { expression.putUserData(PARAMETER, null); } } @Override public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement reference) { if (reference.getUserData(PARAMETER) != null) { reference.putUserData(PARAMETER, null); } } }; for (final PsiElement patternComponent : myPattern) { patternComponent.accept(visitor); } }