palantir / palantir-java-format

A modern, lambda-friendly, 120 character Java formatter.
Apache License 2.0
424 stars 45 forks source link

JDK21 string templates not works #966

Closed GrapeBaBa closed 2 months ago

GrapeBaBa commented 8 months ago

What happened?

If the code contains string templates, spotlessApply will throw errors.

What did you want to happen?

should works fine.

lost22git commented 7 months ago

same problem

Screenshot 2024-01-18 210927

tisonkun commented 6 months ago

Downstream reports - https://github.com/diffplug/spotless/issues/2046

bmarwell commented 6 months ago

Duplicate of https://github.com/palantir/palantir-java-format/issues/930

cushon commented 6 months ago

Duplicate of #930

Maybe not necessarily? Text blocks and string templates are separate features, although they can be used together.

For what it's worth, there were some recent changes to google-java-format to add initial support for string templates, it's possible that well be helpful for palanti-java-format (one, two, three)

bmarwell commented 4 months ago

You are right. It is a preview feature in JDK 21, got me confused :)

mhagnumdw commented 2 months ago

You are right. It is a preview feature in JDK 21, got me confused :)

And in JDK 23: Remove the String Templates preview feature: https://bugs.openjdk.org/browse/JDK-8329949

GrapeBaBa commented 2 months ago

Thanks guys.