ASTNode (@NotNull final ASTNode child) { PsiElement psi = child.getPsi(); if (psi == null) { return child; } final PsiTypeElement typeElement = ((PsiVariable)psi).getTypeElement(); if (typeElement == null) return child; ASTNode lastChildNode = child.getLastChildNode(); if (lastChildNode == null) return child; if (lastChildNode.getElementType() == JavaTokenType.SEMICOLON) return child; ASTNode currentResult = child; for (ASTNode currentNode = child.getTreeNext(); currentNode != null; currentNode = currentNode.getTreeNext()) { if (currentNode.getElementType() == TokenType.WHITE_SPACE || currentNode.getElementType() == JavaTokenType.COMMA || StdTokenSets.COMMENT_BIT_SET.contains(currentNode.getElementType())) { continue; } if (currentNode.getElementType() != JavaElementType.FIELD || !compoundFieldPart(currentNode)) { break; } currentResult = currentNode; } return currentResult; }