boolean (PsiExpression expression) { if (!(expression instanceof PsiMethodCallExpression methodCallExpression)) { return false; } final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); final String methodName = methodExpression.getReferenceName(); if (!HardcodedMethodConstants.OPEN_SESSION.equals(methodName)) { return false; } final PsiExpression qualifier = methodExpression.getQualifierExpression(); return qualifier != null && TypeUtils.expressionHasTypeOrSubtype(qualifier, "org.hibernate.SessionFactory"); }