### Question:
TreeFlatteningRebuildingVisitor extends RebuildingVisitor { @SuppressWarnings("unchecked") public static <T extends JexlNode> T flattenAll(T node) { return TreeFlatteningRebuilder.flattenAll(node); } TreeFlatteningRebuildingVisitor(boolean removeReferences); @SuppressWarnings("unchecked") static T flatten(T node); @SuppressWarnings("unchecked") static T flattenAll(T node); @Override ASTJexlScript apply(ASTJexlScript input); @Override Object visit(ASTJexlScript node, Object data); @Override Object visit(ASTOrNode node, Object data); @Override Object visit(ASTAndNode node, Object data); @Override Object visit(ASTEQNode node, Object data); @Override Object visit(ASTNENode node, Object data); @Override Object visit(ASTLTNode node, Object data); @Override Object visit(ASTGTNode node, Object data); @Override Object visit(ASTLENode node, Object data); @Override Object visit(ASTGENode node, Object data); @Override Object visit(ASTERNode node, Object data); @Override Object visit(ASTNRNode node, Object data); @Override Object visit(ASTNotNode node, Object data); @Override Object visit(ASTIdentifier node, Object data); @Override Object visit(ASTNullLiteral node, Object data); @Override Object visit(ASTTrueNode node, Object data); @Override Object visit(ASTFalseNode node, Object data); @Override Object visit(ASTIntegerLiteral node, Object data); @Override Object visit(ASTFloatLiteral node, Object data); @Override Object visit(ASTStringLiteral node, Object data); @Override Object visit(ASTFunctionNode node, Object data); @Override Object visit(ASTReference node, Object data); @Override Object visit(ASTNumberLiteral node, Object data); @Override Object visit(ASTReferenceExpression node, Object data); @Override Object visit(ASTBlock node, Object data); @Override Object visit(ASTAmbiguous node, Object data); @Override Object visit(ASTIfStatement node, Object data); @Override Object visit(ASTWhileStatement node, Object data); @Override Object visit(ASTForeachStatement node, Object data); @Override Object visit(ASTAssignment node, Object data); @Override Object visit(ASTTernaryNode node, Object data); @Override Object visit(ASTBitwiseOrNode node, Object data); @Override Object visit(ASTBitwiseXorNode node, Object data); @Override Object visit(ASTBitwiseAndNode node, Object data); @Override Object visit(ASTAdditiveNode node, Object data); @Override Object visit(ASTAdditiveOperator node, Object data); @Override Object visit(ASTMulNode node, Object data); @Override Object visit(ASTDivNode node, Object data); @Override Object visit(ASTModNode node, Object data); @Override Object visit(ASTUnaryMinusNode node, Object data); @Override Object visit(ASTBitwiseComplNode node, Object data); @Override Object visit(ASTArrayLiteral node, Object data); @Override Object visit(ASTMapLiteral node, Object data); @Override Object visit(ASTMapEntry node, Object data); @Override Object visit(ASTEmptyFunction node, Object data); @Override Object visit(ASTSizeFunction node, Object data); @Override Object visit(ASTMethodNode node, Object data); @Override Object visit(ASTSizeMethod node, Object data); @Override Object visit(ASTConstructorNode node, Object data); @Override Object visit(ASTArrayAccess node, Object data); @Override Object visit(ASTReturnStatement node, Object data); @Override Object visit(ASTVar node, Object data); @Override Object visit(ASTUnknownFieldERNode node, Object data); @Override Object visit(ASTUnsatisfiableERNode node, Object data);  }### Answer:
@Test public void depthNoStackTraceOrTest() throws Exception { final int numTerms = 10000; final StringBuilder sb = new StringBuilder(13 * numTerms); sb.append("abc_" + StringUtils.leftPad(Integer.toString(numTerms, 10), 5, '0')); for (int i = 2; i <= numTerms; i++) { sb.append(" OR " + i); } Assert.assertNotNull(TreeFlatteningRebuildingVisitor.flattenAll(new Parser(new StringReader(";")).parse(new StringReader(new LuceneToJexlQueryParser() .parse(sb.toString()).toString()), null))); }