ExpressionUtils { public static ExpressionTree skipParentheses(ExpressionTree tree) { ExpressionTree result = tree; while (result.is(Tree.Kind.PARENTHESIZED_EXPRESSION)) { result = ((ParenthesizedTree) result).expression(); } return result; } private  ExpressionUtils(); static boolean isSimpleAssignment(AssignmentExpressionTree tree); static boolean isSelectOnThisOrSuper(AssignmentExpressionTree tree); static boolean isSelectOnThisOrSuper(MemberSelectExpressionTree tree); static IdentifierTree extractIdentifier(AssignmentExpressionTree tree); static Optional<Symbol> extractIdentifierSymbol(ExpressionTree tree); static boolean isInvocationOnVariable(MethodInvocationTree mit, @Nullable Symbol variable, boolean defaultReturn); static ExpressionTree skipParentheses(ExpressionTree tree); static boolean isNullLiteral(ExpressionTree tree); static boolean isSecuringByte(ExpressionTree expression); static IdentifierTree methodName(MethodInvocationTree mit); @CheckForNull static MethodTree getEnclosingMethod(ExpressionTree expr); static Optional<Symbol> getAssignedSymbol(ExpressionTree exp); static boolean isThis(ExpressionTree expression); @CheckForNull static Object resolveAsConstant(ExpressionTree tree);  }
@Test void test_skip_parenthesis() throws Exception { File file = new File("src/test/java/org/sonar/java/model/ExpressionUtilsTest.java"); CompilationUnitTree tree = JParserTestUtils.parse(file); MethodTree methodTree = (MethodTree) ((ClassTree) tree.types().get(0)).members().get(0); ExpressionTree parenthesis = ((ReturnStatementTree) methodTree.block().body().get(0)).expression(); assertThat(parenthesis).is(Tree.Kind.PARENTHESIZED_EXPRESSION); ExpressionTree skipped = ExpressionUtils.skipParentheses(parenthesis); assertThat(skipped).is(Tree.Kind.CONDITIONAL_AND); assertThat(ExpressionUtils.skipParentheses(((BinaryExpressionTree) skipped).leftOperand())).is(Tree.Kind.IDENTIFIER); }