boolean (PsiExpression expression) { if (expression instanceof PsiNewExpression) { return TypeUtils.expressionHasTypeOrSubtype(expression, "java.io.Closeable") && !isIgnoredType(expression); } else if (expression instanceof PsiMethodCallExpression methodCallExpression) { final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); final String methodName = methodExpression.getReferenceName(); if (!"getResourceAsStream".equals(methodName)) { return false; } final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (qualifier == null || TypeUtils.expressionHasTypeOrSubtype(qualifier, CommonClassNames.JAVA_LANG_CLASS, "java.lang.ClassLoader") == null) { return false; } return TypeUtils.expressionHasTypeOrSubtype(expression, "java.io.InputStream"); } return false; }