From 6a6ecf3958dc41eb41419c606858cf41cf782923 Mon Sep 17 00:00:00 2001 From: Rob Stryker <stryker@redhat.com> Date: Mon, 8 Apr 2024 13:33:57 -0400 Subject: [PATCH] Extra parenthesis during if-statements Signed-off-by: Rob Stryker <stryker@redhat.com> --- .../src/org/eclipse/jdt/core/dom/JavacConverter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java index 010903a8548..1b812cc464b 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java @@ -1451,7 +1451,12 @@ private IfStatement convertIfStatement(JCIf javac) { IfStatement res = this.ast.newIfStatement(); commonSettings(res, javac); if (javac.getCondition() != null) { - res.setExpression(convertExpression(javac.getCondition())); + JCExpression expr = javac.getCondition(); + if( expr instanceof JCParens jpc) { + res.setExpression(convertExpression(jpc.getExpression())); + } else { + res.setExpression(convertExpression(expr)); + } } if (javac.getThenStatement() != null) { res.setThenStatement(convertStatement(javac.getThenStatement(), res));