int (@NotNull PsiElement element, int depth) { if (element instanceof PsiExpression) { return hashExpression((PsiExpression)element); } if (element instanceof PsiBlockStatement) { return hashStatements(((PsiBlockStatement)element).getCodeBlock().getStatements()) * 31 + JavaElementType.BLOCK_STATEMENT.getIndex(); } int hash = 0; if (depth > 0) { int count = 0; for (PsiElement child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof PsiWhiteSpace || child instanceof PsiComment || child instanceof PsiJavaToken) { // significant tokens are taken into account by getElementType() continue; } hash = hash * 31 + hashElement(child, depth - 1); count++; } if (count != 0) { hash = hash * 31 + count; } } IElementType type = PsiUtilCore.getElementType(element); if (type != null) { hash = hash * 31 + type.getIndex(); } return hash; }