Skip to content

Support Compact Constructors in Records #275

@pcimcioch

Description

@pcimcioch

Library could support compact constructors in java records:

record Foo(String name, int x, int y) {
  Foo {
    Objects.requireNonNull(name);
  }
}

Currently, as a workaround you can ovveride the whole default constructor:

record Foo(String name, int x, int y) {
    Foo(String name, int x, int y) {
        this.name = Objects.requireNonNull(name);
        this.x = x;
        this.y = y;
    }
}

Metadata

Metadata

Assignees

No one assigned

    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