PsiClass (@NotNull PsiElement context, @Nullable PsiMethod method) { if (method == null) return null; PsiClass targetClass = PsiUtil.resolveClassInType(TypeConversionUtil.erasure(method.getReturnType())); if (targetClass == null) return null; if (!targetClass.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) && !targetClass.hasModifierProperty(PsiModifier.PRIVATE)) { return null; } if (JavaResolveUtil.isAccessible(targetClass, targetClass.getContainingClass(), targetClass.getModifierList(), context, null, null)) { return null; } return targetClass; }