Skip to content

Groovy: guard calls to isSealed() with the check for Groovy 4#6975

Merged
greg-at-moderne merged 3 commits intomainfrom
greg-groovy4-issealed-fix
Mar 13, 2026
Merged

Groovy: guard calls to isSealed() with the check for Groovy 4#6975
greg-at-moderne merged 3 commits intomainfrom
greg-groovy4-issealed-fix

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

@greg-at-moderne greg-at-moderne commented Mar 13, 2026

What's changed?

  • Adding a guard against usage of isSealed() which is a new method in Groovy 4, it won't work in Groovy 2.
  • Fixing the groovy2Test to run using Groovy 2 again, this got likely accidentally broken with Use Groovy 4 parser #6228.

What's your motivation?

Fix:

Caused by: java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ClassNode.isSealed()Z
    at org.openrewrite.groovy.GroovyParserVisitor$RewriteGroovyClassVisitor.visitClass(GroovyParserVisitor.java:331)
    at org.openrewrite.groovy.GroovyParserVisitor.convertTopLevelStatement(GroovyParserVisitor.java:2647)
    at org.openrewrite.groovy.GroovyParserVisitor.visit(GroovyParserVisitor.java:196)

caught by https://github.com/openrewrite/rewrite-gradle-plugin

@greg-at-moderne greg-at-moderne marked this pull request as ready for review March 13, 2026 10:46
@greg-at-moderne greg-at-moderne merged commit eb668c8 into main Mar 13, 2026
1 check passed
@greg-at-moderne greg-at-moderne deleted the greg-groovy4-issealed-fix branch March 13, 2026 10:49
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant