Reputation: 19798
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?
Upvotes: 6
Views: 550
Reputation: 129317
One aspect that I believe javac
will not cover is if you cannot change the 3rd party code to add @Deprecated
annotations. If you just want to avoid a method which has not been marked as deprecated, you can use this plugin I wrote for FindBugs:
https://github.com/Grundlefleck/FindBugs4Deprecating3rdParty
There's very little documentation, so you may need to explore a little yourself. It allows configuring methods and classes to avoid in a properties file. I use it to deprecate org.junit.Assert.assertThat
.
Upvotes: 1
Reputation: 1719
You could also use PMD Sourceforge for this task. There are rules out there that let you find deprecated methods
Upvotes: 1
Reputation: 2558
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
Upvotes: 4