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

Cannot format with string template #2046

Closed
tisonkun opened this issue Feb 17, 2024 · 3 comments
Closed

Cannot format with string template #2046

tisonkun opened this issue Feb 17, 2024 · 3 comments

Comments

@tisonkun
Copy link
Contributor

tisonkun commented Feb 17, 2024

final MemorySegment getpwnam = lookup.find(STR."getpwnam").orElseThrow();
[ERROR] Step 'palantir-java-format' found problem in 'src/main/java/com/tisonkun/morax/directio/Getpwnam.java':
24:53: error: expected token: '.'; generated ) instead
com.palantir.javaformat.java.FormatterException: 24:53: error: expected token: '.'; generated ) instead
    at com.palantir.javaformat.java.Formatter.getFormatReplacements (Formatter.java:302)
    at com.palantir.javaformat.java.Formatter.formatSource (Formatter.java:277)
    at com.palantir.javaformat.java.Formatter.formatSource (Formatter.java:245)
    at com.diffplug.spotless.glue.pjf.PalantirJavaFormatFormatterFunc.apply (PalantirJavaFormatFormatterFunc.java:43)
    at com.diffplug.spotless.FormatterFunc.apply (FormatterFunc.java:32)
    at com.diffplug.spotless.FormatterStepImpl$Standard.format (FormatterStepImpl.java:82)
    at com.diffplug.spotless.FormatterStep$Strict.format (FormatterStep.java:103)
    at com.diffplug.spotless.Formatter.compute (Formatter.java:246)
    at com.diffplug.spotless.PaddedCell.calculateDirtyState (PaddedCell.java:203)
    at com.diffplug.spotless.PaddedCell.calculateDirtyState (PaddedCell.java:190)
    at com.diffplug.spotless.maven.SpotlessApplyMojo.process (SpotlessApplyMojo.java:48)
    at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute (AbstractSpotlessMojo.java:229)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)

Config -

            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <configuration>
                    <java>
                        <palantirJavaFormat>
                            <version>${palantir-java-format.version}</version>
                        </palantirJavaFormat>
                    </java>
                </configuration>
            </plugin>

        <spotless.version>2.39.0</spotless.version>
        <palantir-java-format.version>2.36.0</palantir-java-format.version>

... on JDK 22.

This should not be a spotless issue but palantir doesn't support the new syntax, but I encounter the issue during using spotless so let me report it here for others encountering the same issue first.

Cross-refer to palantir/palantir-java-format#966

@tisonkun
Copy link
Contributor Author

Bumping version to -

        <spotless.version>2.43.0</spotless.version>
        <palantir-java-format.version>2.40.0</palantir-java-format.version>

... doesn't help. Still the same error.

@Goooler
Copy link
Member

Goooler commented Feb 17, 2024

Just wait for PJF to support it, and I'll close this issue.

@Goooler Goooler closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2024
@bmarwell
Copy link

Cross-refer to palantir/palantir-java-format#966

There's also palantir/palantir-java-format#930, which is even older

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants