From d91a3c59768a1bfdcae3a4801f7b019dd3c917a7 Mon Sep 17 00:00:00 2001 From: lingenj Date: Fri, 27 Dec 2024 15:37:29 +0100 Subject: [PATCH] ExpectedToFail "Java style class argument is not yet supported" --- .../groovy/tree/ClassDeclarationTest.java | 31 +++++++++++++++++++ .../groovy/tree/RealWorldGroovyTest.java | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/ClassDeclarationTest.java b/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/ClassDeclarationTest.java index e3acb1f3d33..b478a9211ca 100644 --- a/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/ClassDeclarationTest.java +++ b/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/ClassDeclarationTest.java @@ -341,6 +341,37 @@ class RewriteSettings extends groovy.lang.Script { ); } + @Test + void useClassAsArgument() { + rewriteRun( + groovy( + """ + class A {} + + def test(Class clazz) {} + + test(A) + """ + ) + ); + } + + @Test + @ExpectedToFail("Java style class argument is not yet supported") // https://groovy-lang.org/style-guide.html#_classes_as_first_class_citizens + void useClassAsArgumentJavaStyle() { + rewriteRun( + groovy( + """ + class A {} + + def test(Class clazz) {} + + test(A.class) + """ + ) + ); + } + @Test @ExpectedToFail("Anonymous inner class is not yet supported") // https://groovy-lang.org/objectorientation.html#_anonymous_inner_class void anonymousInnerClass() { diff --git a/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/RealWorldGroovyTest.java b/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/RealWorldGroovyTest.java index c09dab2a76e..42137f46362 100644 --- a/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/RealWorldGroovyTest.java +++ b/rewrite-groovy/src/test/java/org/openrewrite/groovy/tree/RealWorldGroovyTest.java @@ -194,7 +194,7 @@ void apply(Project project) { project.rootProject.subprojects.each { module -> - module.getPlugins().withType(JavaPlugin.class).all { + module.getPlugins().withType(JavaPlugin).all { Properties schemas = new Properties();