Intellij IDEA doesn't grey out some unused methods

后端 未结 3 727
别跟我提以往
别跟我提以往 2021-01-17 17:08

In intellij IDEA, if a method is unused, the method is shown in a gray color. But in some cases, IDEA doesn\'t grey out the method, but when I check the references of those

3条回答
  •  不思量自难忘°
    2021-01-17 17:19

    I used to have it working like charm, but one time, I by mistake clicked on alt+Enter on an unused method, and chose to suppress the inspection on unused code. Ever since then, I stopped getting the grayed out methods and code, so since there is a way to get it undone, there sure must be a way to get it back working.

    After 5 minutes of searching, I found a solution:

    Settings --> Editor --> Inspections --> Java --> Declaration Redundancy --> Unused Declaration

    Make sure you check "Unused Declaration"

    And I just checked by creating a new useless method, working like a charm.

提交回复
热议问题