List<PsiField> (final PsiField variable) { List<PsiField> result = new ArrayList<>(); ASTNode node = variable.getNode(); if (node != null) { while (true) { ASTNode comma = TreeUtil.skipElements(node.getTreeNext(), StdTokenSets.WHITE_SPACE_OR_COMMENT_BIT_SET); if (comma == null || comma.getElementType() != JavaTokenType.COMMA) break; ASTNode nextField = TreeUtil.skipElements(comma.getTreeNext(), StdTokenSets.WHITE_SPACE_OR_COMMENT_BIT_SET); if (nextField == null || nextField.getElementType() != JavaElementType.FIELD) break; result.add((PsiField) nextField.getPsi()); node = nextField; } } return result; }