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

No formatting if record with annotated argument has compact constructor Intellij plugin #574

Closed
benediktsatalia opened this issue Mar 16, 2021 · 0 comments · Fixed by #591
Assignees

Comments

@benediktsatalia
Copy link

benediktsatalia commented Mar 16, 2021

I have a record with an annotated field and a compact constructor. As long as both are present in my record the formatting for the whole file does not work anymore. As soon as I remove either the annotation or the compact constructor it works again.

I am using Intellij with Java 14 Runtime to avoid issue #533.

Here is a minimal example:

package com.company;

import java.util.Objects;
import org.jetbrains.annotations.NotNull;

public record Record(      @NotNull Object o     ) {

  public Record {
    this.o = Objects.requireNonNull(o);
  }
}

As far as I can tell it doesn't matter what annotation is used.

Edit: I just tried to format directly with the jar version 1.9 and get the following error:

Record.java:6:38: error: did not generate token "@"

So it is directly an error from this tool and has nothing to do with the Intellij plugin.

@benediktsatalia benediktsatalia changed the title No formatting if record with annotated argument has compact constructor Intellij plugin does not format if record with annotated argument has compact constructor Mar 16, 2021
@benediktsatalia benediktsatalia changed the title Intellij plugin does not format if record with annotated argument has compact constructor No formatting if record with annotated argument has compact constructor Intellij plugin Mar 16, 2021
@cushon cushon self-assigned this Apr 11, 2021
copybara-service bot pushed a commit that referenced this issue Apr 12, 2021
copybara-service bot pushed a commit that referenced this issue Apr 12, 2021
copybara-service bot pushed a commit that referenced this issue Apr 13, 2021
copybara-service bot pushed a commit that referenced this issue Apr 13, 2021
fawind pushed a commit to palantir/palantir-java-format that referenced this issue Jan 7, 2022
fawind pushed a commit to palantir/palantir-java-format that referenced this issue Jan 7, 2022
fawind pushed a commit to palantir/palantir-java-format that referenced this issue Jan 7, 2022
fawind pushed a commit to palantir/palantir-java-format that referenced this issue Jan 10, 2022
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

Successfully merging a pull request may close this issue.

2 participants