开发者

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

开发者 https://www.devze.com 2023-03-22 03:52 出处:网络
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 ther

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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消