Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java / Eclipse: Removing multiple warnings for 'Unnecessary @SuppressWarnings'

I'm working on a legacy Java App that has about 6k warnings that I am trying to clean up. One of them is simply "Unnecessary @Suppresswarnings('XXXX')". Eclipse has a quick fix for this, but there are several hundred in the codebase, and even more instances where it is actually used.

I would like to be able to apply the "Quick Fix" (remove unused tokens), on all these warnings at once, but can't seem to find a way to make that happen. Since there are many (more) instances of this annotation being used that aren't generating warnings, a brute-force strip of the annotations would just create more warnings.

Is there a way to do this in eclipse (or maybe a third-party tool), or am I just out of luck with this?

like image 490
liam Avatar asked Jul 22 '11 22:07

liam


2 Answers

I would love to be wrong but I think you're out of luck. I know of no way to apply a quick fix to multiple warnings at once.

like image 185
hoipolloi Avatar answered Sep 23 '22 21:09

hoipolloi


Your best bet is to do this outside of Eclipse. Maybe a quick shell script with sed / awk would be enough? If you have complicated rules, you could always write another Java program to strip things out.

like image 41
AngerClown Avatar answered Sep 25 '22 21:09

AngerClown