void (@NotNull PsiReferenceList throwsList, @Nullable String methodClassName) { final PsiJavaCodeReferenceElement[] referenceElements = throwsList.getReferenceElements(); final PsiClassType[] referencedTypes = throwsList.getReferencedTypes(); if (referenceElements.length != referencedTypes.length) { if (methodClassName == null) { final PsiMethod method = PsiTreeUtil.getParentOfType(throwsList, PsiMethod.class); methodClassName = method != null ? method.getClass().getSimpleName() : "null"; } LOGGER.error("Stub-PSI inconsistency detected. " + "The number of elements in the throws list doesn't match the number of types in the throws list. " + "The method's class is " + methodClassName, new Attachment("throwsList.sourcePsi.txt", throwsList.isValid() ? throwsList.getText() : "<invalid>")); } }