@Override
  public CommonProblemDescriptor @Nullable [] checkElement(@NotNull RefEntity refEntity,
                                                           @NotNull AnalysisScope scope,
                                                           @NotNull InspectionManager manager,
                                                           @NotNull GlobalInspectionContext globalContext,
                                                           @NotNull ProblemDescriptionsProcessor processor) {
    if (refEntity instanceof RefMethod refMethod) {

      if (refMethod.isConstructor()) return null;
      if (refMethod.hasSuperMethods()) return null;

      String returnValue = refMethod.getReturnValueIfSame();
      if (returnValue != null) {
        final UMethod method = refMethod.getUastElement();
        final PsiType returnType = method.getReturnType();
        if (returnType == null || returnType.equalsToText(CommonClassNames.JAVA_LANG_VOID)) {
          return null;
        }

        final String message;
        if (refMethod.getDerivedReferences().isEmpty()) {
          message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor", returnValue);
        } else if (refMethod.hasBody()) {
          message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor1", returnValue);
        } else {
          message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor2", returnValue);
        }

        UElement anchor = method.getUastAnchor();
        if (anchor != null) {
          PsiElement psiAnchor = anchor.getSourcePsi();
          if (psiAnchor != null) {
            return new ProblemDescriptor[] {
              manager.createProblemDescriptor(psiAnchor, message, false, null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING)
            };
          }
        }
      }
    }

    return null;
  }
@Override
  public CommonProblemDescriptor @Nullable [] checkElement(@NotNull RefEntity refEntity,
                                                           @NotNull AnalysisScope scope,
                                                           @NotNull InspectionManager manager,
                                                           @NotNull GlobalInspectionContext globalContext,
                                                           @NotNull ProblemDescriptionsProcessor processor)