boolean (PsiElement nextSibling) { if (!(nextSibling instanceof PsiDeclarationStatement declarationStatement)) { return false; } final PsiElement[] elements = declarationStatement.getDeclaredElements(); if (elements.length == 0) { return false; } final PsiElement lastElement = elements[elements.length - 1]; return !(lastElement instanceof PsiClass) && PsiUtil.isJavaToken(lastElement.getLastChild(), JavaTokenType.SEMICOLON); }