diff --git a/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java b/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java index c7b8b308..d6e8b0fe 100644 --- a/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java +++ b/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java @@ -2490,7 +2490,7 @@ public J visitDotQualifiedExpression(KtDotQualifiedExpression expression, Execut .withPrefix(prefix); } else if (j instanceof J.NewClass) { J.NewClass n = (J.NewClass) j; - if (receiver instanceof J.FieldAccess || receiver instanceof J.Identifier || receiver instanceof J.NewClass) { + if (receiver instanceof J.FieldAccess || receiver instanceof J.Identifier || receiver instanceof J.NewClass || receiver instanceof K.This) { n = n.withPrefix(prefix); if (n.getClazz() instanceof J.ParameterizedType) { J.ParameterizedType pt = (J.ParameterizedType) n.getClazz(); diff --git a/src/test/java/org/openrewrite/kotlin/tree/ThisTest.java b/src/test/java/org/openrewrite/kotlin/tree/ThisTest.java index a2e02d5d..244a7c4d 100644 --- a/src/test/java/org/openrewrite/kotlin/tree/ThisTest.java +++ b/src/test/java/org/openrewrite/kotlin/tree/ThisTest.java @@ -47,4 +47,18 @@ override fun iterator(): MutableIterator> { ) ); } + + @Test + void innerClass() { + rewriteRun( + kotlin( + """ + class Foo { + fun bar() = this.Bar() + inner class Bar + } + """ + ) + ); + } }