Skip to content

Allow unsupported syntax, like record classes #8023

@runfalk

Description

@runfalk

In a new project we are using Java 14 Record classes (preview feature). The problem is that checkstyle crashes when parsing record classes with methods like:

public record Person(
        String firstName,
        String lastName,
        int age,
        String address,
        Date birthday
){
    public Person{
      // record ctor
    }

    public String fullName(){
        return firstName + " " + lastName;
    }
}

It sort of works with an error when there are no methods.

While I appreciate that you may not want to add support for a feature that is subject to change, it would be very helpful to have some way of skipping checks for new syntax. I'm aware of the possibility to exclude files using regex, but the great thing about record classes is that you can embed them in classes without the number of lines blowing up.

Preferably I'd like some way of ignoring the record classes but still check the rest of the code in the file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions