Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Groovy Parser correctly handle nested parenthesis #4718

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

jevanlingen
Copy link
Contributor

What's changed?

Nested parentheses are supported as well for the groovy parser.

What's your motivation?

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@jevanlingen jevanlingen linked an issue Nov 26, 2024 that may be closed by this pull request
@jevanlingen jevanlingen force-pushed the 4703-groovy-parser-does-not-correctly-handle-nested-parenthesis branch from 8579420 to 378fe5b Compare November 26, 2024 09:37
@@ -1664,9 +1667,13 @@ public void visitMethodCallExpression(MethodCallExpression call) {
Expression selectExpr = visit(call.getObjectExpression());
Copy link
Contributor Author

@jevanlingen jevanlingen Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some changes below this line, but I have the feeling I am at the wrong track. For instance with following groovy code:

(map.get("foo")).equals("bar")`

I can retrieve here an expression that looks printed like (map.get("foo"). I think you would expect it evenly distributed like (map.get("foo")). So maybe that's what should be changed instead of the code here below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stop working on this for now. I can't wrap my head around how the parentheses are set. I probably need a little bit more experience before I start working on parser code 😇.

@timtebeek timtebeek added parser-groovy bug Something isn't working labels Nov 26, 2024
@jevanlingen jevanlingen changed the title Skip ending parentheses when parsing visitMethodCallExpression Make Groovy Parser correctly handle nested parenthesis Nov 26, 2024
@jevanlingen jevanlingen removed their assignment Nov 26, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-core/src/main/java/org/openrewrite/internal/AdaptiveRadixTree.java
    • lines 594-594
  • rewrite-core/src/main/java/org/openrewrite/internal/lang/NonNull.java
    • lines 18-18
    • lines 43-43

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-core/src/main/java/org/openrewrite/internal/AdaptiveRadixTree.java
    • lines 594-594
  • rewrite-core/src/main/java/org/openrewrite/internal/lang/NonNull.java
    • lines 18-18
    • lines 43-43

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-core/src/main/java/org/openrewrite/internal/AdaptiveRadixTree.java
    • lines 594-594
  • rewrite-core/src/main/java/org/openrewrite/internal/lang/NonNull.java
    • lines 18-18
    • lines 43-43

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-core/src/main/java/org/openrewrite/internal/AdaptiveRadixTree.java
    • lines 594-594
  • rewrite-core/src/main/java/org/openrewrite/internal/lang/NonNull.java
    • lines 18-18
    • lines 43-43

@jevanlingen jevanlingen force-pushed the 4703-groovy-parser-does-not-correctly-handle-nested-parenthesis branch from bc3b03b to fe98f02 Compare November 29, 2024 12:49
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-core/src/main/java/org/openrewrite/internal/AdaptiveRadixTree.java
    • lines 594-594
  • rewrite-core/src/main/java/org/openrewrite/internal/lang/NonNull.java
    • lines 18-18
    • lines 43-43

@jevanlingen jevanlingen force-pushed the 4703-groovy-parser-does-not-correctly-handle-nested-parenthesis branch from fe98f02 to b7e03e9 Compare December 2, 2024 08:19
@jevanlingen jevanlingen force-pushed the 4703-groovy-parser-does-not-correctly-handle-nested-parenthesis branch from 5c22da6 to fe378e2 Compare December 3, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-groovy
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Groovy parser does not correctly handle nested parenthesis
2 participants