void (@NotNull PsiMethod method) { super.visitMethod(method); if (method.isConstructor() || method.getReturnType() instanceof PsiPrimitiveType) { return; } final Collection<PsiMethod> overridingMethods = OverridingMethodsSearch.search(method).findAll(); for (final PsiMethod overridingMethod : overridingMethods) { if (isNullable(overridingMethod)) { registerNullableAnnotation(method); return; } } final NullableNotNullManager manager = NullableNotNullManager.getInstance(method.getProject()); if (!manager.isNotNull(method, false) && manager.isNotNull(method, true)) { registerNotNullAnnotation(method); return; } if (hasNullability(method)) { return; } Nullability nullability = DfaUtil.inferMethodNullability(method); if (nullability == Nullability.NULLABLE) { registerNullableAnnotation(method); return; } if (nullability == Nullability.NOT_NULL) { for (final PsiMethod overridingMethod : overridingMethods) { if (!isNotNull(overridingMethod)) { return; } } //and check that all the submethods are not nullable registerNotNullAnnotation(method); } }