ASTNode (int role) { LOG.assertTrue(ChildRole.isUnique(role)); switch(role){ default: return null; case ChildRole.TRY_KEYWORD: return findChildByType(TRY_KEYWORD); case ChildRole.TRY_BLOCK: return findChildByType(CODE_BLOCK); case ChildRole.FINALLY_KEYWORD: return findChildByType(FINALLY_KEYWORD); case ChildRole.FINALLY_BLOCK: ASTNode finallyKeyword = findChildByRole(ChildRole.FINALLY_KEYWORD); if (finallyKeyword == null) return null; for(ASTNode child = finallyKeyword.getTreeNext(); child != null; child = child.getTreeNext()){ if (child.getElementType() == CODE_BLOCK){ return child; } } return null; } }