Skip to content

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

Closed
@benediktsatalia

Description

@benediktsatalia

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions