boolean (PsiExpression expression) { if (expression instanceof PsiMethodCallExpression methodCallExpression) { final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if ("list".equals(methodName) || "listBindings".equals(methodName)) { final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (qualifier == null) { return false; } return TypeUtils.expressionHasTypeOrSubtype(qualifier, "javax.naming.Context"); } else if ("getAll".equals(methodName)) { final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (qualifier == null) { return false; } return TypeUtils.expressionHasTypeOrSubtype(qualifier, "javax.naming.directory.Attribute", "javax.naming.directory.Attributes") != null; } else { return false; } } else if (expression instanceof PsiNewExpression) { return TypeUtils.expressionHasTypeOrSubtype(expression, "javax.naming.InitialContext"); } return false; }