openrewrite / rewrite-kotlin

Work-in-progress implementation of Kotlin language support for OpenRewrite.
Apache License 2.0
47 stars 13 forks source link

Unexpected formatting after AddImport with `@file` use site annotation. #500

Closed traceyyoshima closed 11 months ago

traceyyoshima commented 11 months ago
    @Test
    void addImport() {
        rewriteRun(
          spec -> spec.recipe(importTypeRecipe("java.util.List")),
          kotlin(
            """
              @file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
              class A
              """,
            """
              @file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
              import java.util.List

              class A
              """
          )
        );
    }
kunli2 commented 11 months ago

IntelliJ format this to add two new lines before the import, so we might want to update the test case above.

@file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")

import java.util.List

class C