SyntacticEquivalence { public static ExpressionTree skipParentheses(ExpressionTree tree) { if (tree == null) { return null; } else if (tree.is(Tree.Kind.PARENTHESISED_EXPRESSION)) { return skipParentheses(((ParenthesisedExpressionTree) tree).expression()); } else { return tree; } } private  SyntacticEquivalence(); static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList); static boolean areEquivalent(@Nullable Tree leftNode, @Nullable Tree rightNode); static ExpressionTree skipParentheses(ExpressionTree tree);  }
@Test public void test_skip_parenthesis() throws Exception { IfStatementTree tree1 = (IfStatementTree) parse("IF (TRUE) THEN END IF;", Tree.Kind.IF_STATEMENT); IfStatementTree tree2 = (IfStatementTree) parse("IF TRUE THEN END IF;", Tree.Kind.IF_STATEMENT); assertThat(SyntacticEquivalence.skipParentheses(tree1.condition()).is(Kind.BOOLEAN_LITERAL)).isTrue(); assertNotNull(tree2); assertNull(SyntacticEquivalence.skipParentheses(null)); }