palantir / palantir-java-format

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

Cannot identify instanceof with name #925

Closed tisonkun closed 1 year ago

tisonkun commented 1 year ago

What happened?

    public static UncheckedIOException asUncheckedIOException(Throwable t) {
        if (t instanceof UncheckedIOException /* <- FormatterException here */e) {
            return e;
        } else if (t instanceof IOException e) {
            return new UncheckedIOException(e);
        } else {
            return new UncheckedIOException(new IOException(t));
        }
    }
[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.39.0:apply (default-cli) on project morax-proto: Unable to format file /Users/tison/Brittani/morax/morax-proto/src/main/java/org/tisonkun/morax/proto/exception/ExceptionUtils.java: com.palantir.javaformat.java.FormatterException: 57:47: error: ')' expected -> [Help 1]

What did you want to happen?

Properly formatted.

tisonkun commented 1 year ago

The same for the new record syntax.

tisonkun commented 1 year ago

It seems my fault to set a different JDK in use.