Skip to content

Conversation

mahfouz72
Copy link
Member

closes #14971

@nrmancuso nrmancuso self-requested a review June 15, 2024 22:39
@nrmancuso nrmancuso self-assigned this Jun 15, 2024
Copy link
Contributor

@nrmancuso nrmancuso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@nrmancuso nrmancuso assigned rnveach and unassigned nrmancuso Jun 16, 2024
@nrmancuso nrmancuso requested a review from rnveach June 16, 2024 14:39
Copy link
Contributor

@rnveach rnveach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, we are only validating LITERAL_WHEN and things around it, correct?

Point(int x, int y) //indent:20 exp:20
when x > 0 && y > 0 -> System.out.println(x + y); //indent:12 exp:16 warn
case Point(int x, int y) -> System.out.println("error"); //indent:12 exp:12
} //indent:8 exp:8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an input like: (indentation is intentional)

        switch (p) { //indent:8 exp:8
            case    //indent:12 exp:12
Point(int x, int y)
when
x > 0 && y > 0
->
System.out.println(x + y);
            case Point(int x, int y) -> System.out.println("error"); //indent:12 exp:12
        } //indent:8 exp:8

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, we are only validating LITERAL_WHEN and things around it, correct?

Yes

Add an input like: (indentation is intentional)

done.

System.out.println(x + y);

this is weird indent:0 expected:0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is weird indent:0 expected:0

Exactly. :)

This is a bug. Most likely this line is not being validated.

You will only see issues with this check if you do bad indentation. You other examples were "too good".

After talking with @nrmancuso , move this to a new issue. We need to continue opening other issues and will probably return to indentation later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mahfouz72 Is this done?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnveach rnveach merged commit b79d89c into checkstyle:master Jun 22, 2024
@mahfouz72 mahfouz72 deleted the indentaton branch May 9, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add Check Support for Java 21 Pattern Matching for Switch Syntax: Indentation
3 participants