Skip to content

Issue #18926: Re-enable 'EmptyClass' inspection#19029

Merged
romani merged 1 commit into
checkstyle:masterfrom
avadhutmali:issue-18926-empty-class
Mar 10, 2026
Merged

Issue #18926: Re-enable 'EmptyClass' inspection#19029
romani merged 1 commit into
checkstyle:masterfrom
avadhutmali:issue-18926-empty-class

Conversation

@avadhutmali

@avadhutmali avadhutmali commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #18926

This PR re-enables the EmptyClass inspection in Qodana.

Note to reviewers: I am opening this PR as a draft initially to trigger the Qodana CI pipeline and filter the exact list of files violating this specific inspection. I will push the code fixes shortly once the CI provides the targeted report.

@avadhutmali avadhutmali force-pushed the issue-18926-empty-class branch 4 times, most recently from 8a83f60 to b9c97c0 Compare February 25, 2026 21:39
@avadhutmali

Copy link
Copy Markdown
Contributor Author

@romani
I re-enabled the EmptyClass inspection. There are 0 actual violations in the codebase.
However, Qodana flags one false positive in JavadocCommentsTokenTypes.java at line 1804:

  • {@code * {@snippet :config}}

IntelliJ/Qodana evaluates the injected {@snippet} tag as a standalone file, which triggers the EmptyClass error. Since standard @SuppressWarnings is blocked by Checkstyle, and @noinspection is ignored by Qodana's isolated snippet parser, what is the preferred way to suppress this false positive?

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Items

* }</pre>
*
* @noinspection EmptyClass
* @noinspectionreason EmptyClass - false positive from Language Injection in snippet block

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Try to add to allowed suppressions for idea

<option name="myAllowedSuppressions">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suppression on field is not working.
Try to put suppression javadoc tags to class, not a field.

Please reproduce this problem in Idea on your local and ask Idea to suppress by annotation, and add javadoc tags to same element.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I opened the file in IntelliJ IDEA locally and reproduced the false positive — the {@snippet} injected block inside the COLON field javadoc is flagged as EmptyClass due to Language Injection. IntelliJ's "Suppress for class" quick-fix generated @SuppressWarnings("EmptyClass") and the matching @noinspection javadoc tags on the class element. However, IntelliJ's auto-formatter kept introducing formatting violations against checkstyle's strict rules, so I applied the changes manually in VS Code, mirroring exactly what IntelliJ's quick-fix produced. Also added EmptyClass to myAllowedSuppressions in intellij-idea-inspections.xml.

@avadhutmali avadhutmali force-pushed the issue-18926-empty-class branch 3 times, most recently from 5ff12bc to e73e2f4 Compare February 26, 2026 04:05
@romani

romani commented Feb 26, 2026

Copy link
Copy Markdown
Member

https://checkstyle.org/idea.html#Inspections

Please reproduce it on local.

@avadhutmali avadhutmali force-pushed the issue-18926-empty-class branch 3 times, most recently from d4f7cbf to 1924410 Compare February 26, 2026 10:25
@romani

romani commented Mar 8, 2026

Copy link
Copy Markdown
Member

We need green CI to merge, only circleci failure is known instability .

https://ci.appveyor.com/project/Checkstyle/checkstyle/builds/53603210/job/5l406iy3qwa512sn#L100

[ERROR] [checkstyle] [ERROR] C:\projects\checkstyle\src\main\java\com\puppycrawl\tools\checkstyle\api\JavadocCommentsTokenTypes.java:1826: Trailing whitespace is not allowed [noTrailingWhitespace]

Copilot AI review requested due to automatic review settings March 8, 2026 16:10
@avadhutmali avadhutmali force-pushed the issue-18926-empty-class branch 2 times, most recently from a44749c to eb596fd Compare March 8, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR re-enables the EmptyClass inspection in Qodana (issue #18926) by updating the IntelliJ IDEA inspection configuration and suppressing the inspection on a class that triggers a false positive.

Changes:

  • Re-enables the EmptyClass (and Java9ReflectionClassVisibility) inspection in the IntelliJ IDEA inspections config.
  • Adds EmptyClass to a suppression list for a specific inspection tool in the config.
  • Suppresses the EmptyClass inspection on JavadocCommentsTokenTypes.java with a documented reason.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
config/intellij-idea-inspections.xml Re-enables EmptyClass and Java9ReflectionClassVisibility inspections; adds EmptyClass to an exclusion list for a specific tool
src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocCommentsTokenTypes.java Suppresses the EmptyClass inspection on the class with a false-positive reason

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/intellij-idea-inspections.xml Outdated
@@ -1682,7 +1682,7 @@
<inspection_tool class="EmptyCatchBlockJS" enabled="true" level="ERROR"
enabled_by_default="true"/>
<!-- temporary disabled until https://github.com/checkstyle/checkstyle/issues/18926 -->

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

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

The comment on line 1684 ("temporary disabled until ...") was not removed when the inspection was re-enabled. Since this inspection is now enabled and the issue is resolved, the stale comment should be removed.

Suggested change
<!-- temporary disabled until https://github.com/checkstyle/checkstyle/issues/18926 -->

Copilot uses AI. Check for mistakes.
@avadhutmali avadhutmali force-pushed the issue-18926-empty-class branch 3 times, most recently from 0ec45a5 to ff2a2e3 Compare March 8, 2026 16:31
@avadhutmali

Copy link
Copy Markdown
Contributor Author

@romani , I am still working on fixing the remaining CI failures. Will update the PR once all checks are green. Thank you for your patience. I will ping u when it complete from my side

@romani

romani commented Mar 9, 2026

Copy link
Copy Markdown
Member

@avadhutmali, this is last fix for this issue, please find time to fix it sooner

@avadhutmali avadhutmali force-pushed the issue-18926-empty-class branch 3 times, most recently from 8a8da07 to 47810b5 Compare March 10, 2026 07:07
@avadhutmali

Copy link
Copy Markdown
Contributor Author

We need green CI to merge, only circleci failure is known instability .

@romani , Ping

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Last

* javadoc - The Java API Documentation Generator</a>
* @noinspection JavadocDeclaration
* @noinspection JavadocDeclaration ,EmptyClass
* @noinspectionreason JavadocDeclaration - Javadoc is intentional

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add new line for new noinspectionreason to explain reason we do suppression

@avadhutmali avadhutmali force-pushed the issue-18926-empty-class branch from 47810b5 to c0b6f6c Compare March 10, 2026 12:44
@avadhutmali avadhutmali requested a review from romani March 10, 2026 12:48

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot

@romani romani merged commit 68ef159 into checkstyle:master Mar 10, 2026
119 of 123 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-enable inspections that were temporarily suppressed for Qodana

3 participants