Ref<PyType> (@NotNull PsiElement referenceTarget, @NotNull TypeEvalContext context, @Nullable PsiElement anchor) { if (referenceTarget instanceof PsiClass) { return Ref.create(new PyJavaClassType((PsiClass)referenceTarget, true)); } if (referenceTarget instanceof PsiPackage) { final Module module = anchor == null ? null : ModuleUtilCore.findModuleForPsiElement(anchor); return Ref.create(new PyJavaPackageType((PsiPackage)referenceTarget, module)); } if (referenceTarget instanceof PsiMethod) { return Ref.create(new PyJavaMethodType((PsiMethod)referenceTarget)); } if (referenceTarget instanceof PsiField) { return PyTypeUtil.notNullToRef(asPyType(((PsiField)referenceTarget).getType())); } return null; }