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

UseTextBlocks - incorrect escaping for Kotlin #367

Open
nmck257 opened this issue Dec 8, 2023 · 1 comment
Open

UseTextBlocks - incorrect escaping for Kotlin #367

nmck257 opened this issue Dec 8, 2023 · 1 comment
Labels
bug Something isn't working parser-kotlin

Comments

@nmck257
Copy link
Contributor

nmck257 commented Dec 8, 2023

What version of OpenRewrite are you using?

rewrite-recipe-bom 2.5.1

How are you running OpenRewrite?

maven plugin 5.14.1

What is the smallest, simplest way to reproduce the problem?

const val s = "[{\n" +
        "    \"errorSource\"      : \"source\",\n" +
        "    \"errorCode\"        : \"code\",\n" +
        "    \"errorDescription\" : \"error\"\n" +
        "}]"

What did you expect to see?

const val s = """
[{
    "errorSource"      : "source",
    "errorCode"        : "code",
    "errorDescription" : "error"
}]
"""

What did you see instead?

const val s = """
[{\\n\
    \\"errorSource\\"      : \\"source\\",\\n\
    \\"errorCode\\"        : \\"code\\",\\n\
    \\"errorDescription\\" : \\"error\\"\\n\
}]\
"""

(note that this was on Windows, in case that's relevant to some of those escapes near the line endings)

Are you interested in contributing a fix to OpenRewrite?

Sorta? Mostly I'm curious:

  • is it premature for us to start "fixing" (optimizing?) existing Java visitors to also make good choices for Kotlin?
  • do we have any established patterns / samples for how a visitor should take different codepaths based on whether it's visiting Java/Kotlin/something else?
@nmck257 nmck257 added the bug Something isn't working label Dec 8, 2023
@timtebeek timtebeek moved this to Backlog in OpenRewrite Dec 8, 2023
@knutwannheden
Copy link
Contributor

/cc @traceyyoshima

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

3 participants