From 7612f242e3cfa44eccf4ec35edb6d16d1de4d0f4 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Mon, 11 Sep 2023 09:43:30 +0200 Subject: [PATCH] Also parse other class members in enum classes Fixes: #307 --- .../org/openrewrite/kotlin/internal/KotlinParserVisitor.kt | 4 ---- src/test/java/org/openrewrite/kotlin/tree/EnumTest.java | 2 -- 2 files changed, 6 deletions(-) diff --git a/src/main/kotlin/org/openrewrite/kotlin/internal/KotlinParserVisitor.kt b/src/main/kotlin/org/openrewrite/kotlin/internal/KotlinParserVisitor.kt index 2e44c3974..8c0725af9 100644 --- a/src/main/kotlin/org/openrewrite/kotlin/internal/KotlinParserVisitor.kt +++ b/src/main/kotlin/org/openrewrite/kotlin/internal/KotlinParserVisitor.kt @@ -3989,10 +3989,6 @@ class KotlinParserVisitor( val range = TextRange(declaration.source!!.startOffset, declaration.source!!.endOffset) generatedFirProperties[range] = declaration } else { - // We aren't interested in the generated values. - if (ClassKind.ENUM_CLASS == classKind && declaration.source != null) { - continue - } membersMultiVariablesSeparated.add(declaration) } } diff --git a/src/test/java/org/openrewrite/kotlin/tree/EnumTest.java b/src/test/java/org/openrewrite/kotlin/tree/EnumTest.java index a5ceb5a37..181726b40 100644 --- a/src/test/java/org/openrewrite/kotlin/tree/EnumTest.java +++ b/src/test/java/org/openrewrite/kotlin/tree/EnumTest.java @@ -16,7 +16,6 @@ package org.openrewrite.kotlin.tree; import org.junit.jupiter.api.Test; -import org.junitpioneer.jupiter.ExpectedToFail; import org.openrewrite.Issue; import org.openrewrite.test.RewriteTest; @@ -141,7 +140,6 @@ fun foo() = print("foo",) @Test @Issue("https://github.com/openrewrite/rewrite-kotlin/issues/307") - @ExpectedToFail void enumWithFunction() { rewriteRun( kotlin(