Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the checkstyle configuration to allow suppressing specific checkstyle warnings via annotations #9318

Closed
Tracked by #8609
npepinpe opened this issue May 6, 2022 · 0 comments · Fixed by #9325
Assignees
Labels
area/build Marks an issue as related to our build pipeline (e.g. Maven settings, CI, etc.) kind/toil Categorizes an issue or PR as general maintenance, i.e. cleanup, refactoring, etc. version:8.1.0-alpha2 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0

Comments

@npepinpe
Copy link
Member

npepinpe commented May 6, 2022

Description

Checkstyle does not yet properly handle the new switch expressions we have available in JDK 17. As a result, it flags such as things with INNER_ASSIGNMENT:

MyObject obj;
switch (expression) {
  VALUE -> obj = new MyObject();
  default -> obj = DEFAULT_OBJECT;
}

This check is normally for such things, where it makes sense:

MyObject obj;
if (obj = new MyObject()) {

}

For switch expressions, I think it's perfectly fine to let it assign.

To circumvent this, you can use SuppressWarnings to suppress checks for certain expressions, methods, etc. Unfortunately we need to update the configuration for this.

Additionally, please update the build pipeline so build-tools is always installed before running the checks, as otherwise the latest configuration is not picked up.

@npepinpe npepinpe added kind/toil Categorizes an issue or PR as general maintenance, i.e. cleanup, refactoring, etc. area/build Marks an issue as related to our build pipeline (e.g. Maven settings, CI, etc.) labels May 6, 2022
@npepinpe npepinpe self-assigned this May 6, 2022
@ghost ghost closed this as completed in 6a38ef8 May 9, 2022
@ChrisKujawa ChrisKujawa added the version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0 label Oct 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Marks an issue as related to our build pipeline (e.g. Maven settings, CI, etc.) kind/toil Categorizes an issue or PR as general maintenance, i.e. cleanup, refactoring, etc. version:8.1.0-alpha2 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants