From e948c67920cb4e5e29da2e9ee7f83f14b717c2d6 Mon Sep 17 00:00:00 2001 From: Laurens Westerlaken Date: Fri, 20 Dec 2024 14:18:01 +0100 Subject: [PATCH] Try alternative way of determining parenthesis level for `BinaryExpression` when AST doesn't provide `_INSIDE_PARENTHESES_LEVEL` flag --- .../main/java/org/openrewrite/groovy/GroovyParserVisitor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java b/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java index 2e8b26ae7b3..5ce8d628352 100644 --- a/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java +++ b/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java @@ -2540,6 +2540,10 @@ private int sourceLengthOfString(ConstantExpression expr) { } else if (node instanceof MethodCallExpression) { MethodCallExpression expr = (MethodCallExpression) node; return determineParenthesisLevel(expr.getObjectExpression().getLineNumber(), expr.getLineNumber(), expr.getObjectExpression().getColumnNumber(), expr.getColumnNumber()); + } else if (node instanceof BinaryExpression) { + BinaryExpression expr = (BinaryExpression) node; + return determineParenthesisLevel(expr.getLeftExpression().getLineNumber(), expr.getLineNumber(), expr.getLeftExpression().getColumnNumber(), expr.getColumnNumber()); + } return null; }