PsiType (PsiMethod method, @NotNull PsiType returnType) { for (PsiMethod superMethod : method.findDeepestSuperMethods()) { PsiType superMethodReturnType = superMethod.getReturnType(); if (superMethodReturnType != null && superMethodReturnType.isAssignableFrom(returnType)) { if (superMethodReturnType instanceof PsiClassType && returnType instanceof PsiPrimitiveType) { return ((PsiPrimitiveType)returnType).getBoxedType(method); } return returnType; } } return null; }