boolean (final PsiElement element, final PsiClass classToBind, final LwRootContainer rootContainer, @Nullable final Ref<? super Boolean> callsThisConstructor) { final Ref<Boolean> result = new Ref<>(Boolean.FALSE); element.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitReferenceExpression(final @NotNull PsiReferenceExpression expression) { super.visitReferenceElement(expression); final PsiElement psiElement = expression.resolve(); if (psiElement == null) { return; } if (psiElement instanceof PsiField field) { if (field.getContainingClass().equals(classToBind)) { if (Utils.isBoundField(rootContainer, field.getName())) { result.set(Boolean.TRUE); } } } else if (psiElement instanceof PsiMethod method) { if (method.isConstructor()) { if (method.getContainingClass() == classToBind) { if (callsThisConstructor != null) { callsThisConstructor.set(Boolean.TRUE); } } else if (method.getContainingClass() != classToBind.getSuperClass()) { result.set(Boolean.TRUE); } } else { result.set(Boolean.TRUE); } } } }); return result.get().booleanValue(); }