Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can FindBugs be used to flag code that uses a method that's been blacklisted?

Tags:

java

findbugs

We're trying to move our very large codebase from Guava 11 to Guava 14 and would like to catch uses of removed or deprecated APIs. Can FindBugs perform such checking? If so, how?

like image 331
Noel Yap Avatar asked Mar 13 '13 20:03

Noel Yap


2 Answers

One solution would be to just use Oracle's Java compiler javac to do this.

Removed methods in the API would result in compiler errors if they are used so it should be possible to find these by compiling the code.

Deprecated methods can be found using the javac -deprecation option. More on -deprecation here: http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javac.html

like image 66
uldall Avatar answered Sep 30 '22 02:09

uldall


You could also use PMD Sourceforge for this task. There are rules out there that let you find deprecated methods

like image 20
Greg Avatar answered Sep 30 '22 02:09

Greg