Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idempotent print issue: on imports with $ characters in class name #559

Open
traceyyoshima opened this issue Dec 21, 2023 · 1 comment
Open
Labels
bug Something isn't working parser-kotlin

Comments

@traceyyoshima
Copy link
Contributor

Source: https://github.com/KengoTODA/flix-gradle-plugin/blob/main

import ca.uwaterloo.flix.tools.`Tester$`
@kunli2
Copy link
Contributor

kunli2 commented Jan 3, 2024

This is a test to reproduce this issue, from the example source project, seems this is a way to import scala objests.

    @Test
    void scalaImport() {
        rewriteRun(
          kotlin(
            """
              import my.org.`x$`

              fun main() {

              }
              """
          )
        );
    }

It got a StringIndexOutOfBoundsException. the root cause is here, when building a typeTree, the delimiter includes $, but for this case, we don't want to delimiter it by $.

I found that $ delimiter is added by this commit, @knutwannheden maybe you know the background of this change.
I have verified that if we change the delimiter back (without $), then this test will pass.

@timtebeek timtebeek moved this to Backlog in OpenRewrite May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-kotlin
Projects
Status: Backlog
Development

No branches or pull requests

2 participants