How to use Intellij to detect unused fields in a Java record?

Answered

IDE version: 2023.2.5 Ultimate Edition

As of right now, I can't seem to find a way to perform any kind of unused code detection for Java records.

Field name grey-out on unused code does not seem to work on the record's constructor, and code analysis shows nothing in its radar either.

0
1 comment
Official comment

Hello, “Unused declaration” inspection will report an unused record's constructor, but not fields. Please see the reasoning here https://youtrack.jetbrains.com/issue/IDEA-245147/Unused-declaration-inspection-doesnt-work-for-record-members#focus=Comments-27-4244622.0-0

Please sign in to leave a comment.