2

We're using IDEA IntelliJ for our Java coding. In the past some heavily used @SuppressWarnings annotations or noinspection comments to suppress warnings/inspections in the IDE others disabled some inspections. Now we start using the same inspection base for all programmers. However the code now is cluttered with annotations and noinspection comments that are not necessary any more for the inspections are disabled.

Is there a way to remove all @SuppressWarnings annotations or noinspection comments in the whole project that are not necessary any more due to disabled inspections in IntelliJ?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Spock
  • 260
  • 1
  • 13
  • with editor you could use: 'find and replace' facility – a3.14_Infinity Apr 19 '16 at 12:43
  • I don't think there is an automatic way, so you might have to take the time to do a project-wide find & replace. Of course that'll find all of them, not just the unnecessary ones, though – OneCricketeer Apr 19 '16 at 12:45
  • did you try '@SuppressWarnings("unchecked")' ? – Tupac Apr 19 '16 at 12:46
  • look at this answer: http://stackoverflow.com/a/19398420/3669309 – Tupac Apr 19 '16 at 12:48
  • I'd rather avoid the find-and-replace way for in a project with zillions lines of code this is quite error prone. – Spock Apr 19 '16 at 13:01
  • 2
    @Tupac, it seems you misunderstood my questions: I do not want to add a `@SuppressWarning`, I want to remove them if they are unnecessary. – Spock Apr 19 '16 at 13:03

1 Answers1

1

IntelliJ IDEA will have an inspection which will highlight redundant usages of @SuppressWarning annotation in editor starting from version 2018.3. You can run this inspection on whole project and quickly remove all unneeded annotations.

Rara
  • 639
  • 9
  • 22