Skip to content

cleanthat fails to parse unnamed parameters with Maven while this works with Gradle #2843

@digital-wonderland

Description

@digital-wonderland

I'm using version 3.2.1 of your Maven plugin.

When I enable <cleanthat/> within <java>, parsing fails when encountering Unnamed Variables & Patterns.

For example code like this:

try {
    return msg.getAllRecipients()[0].toString().contains(email);
} catch (Exception _) {
    return false;
}

fails to parse with errors like this:

Issue parsing some source. 1 problems. First problem: (line 48,col 34) '_' is a reserved keyword.

Here someone stated that this works fine with your Gradle plugin when overriding the JavaParser version to 3.28.0 but for me this made no difference in Maven.

Could you please have a look what the difference in the cleanthat results between your Gradle and Maven plugins might be?

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