The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Java find deprecated methods

I'm working on a little project to find if my company has removed non-deprecated methods/classes from release to release.

Normally, I'd go for a simple binary compatibility checker using the various Class methods, but we allow ourselves to remove methods/classes if they've been deprecated for two releases.

Right now, I'm looking at using our javadoc annotations to check compatibility (since they include a @deprecated tag), but that seems a kind of goofy way to go.  Is there a way to check for things like deprecation without using the javadocs?  Even better, has anything like this been implemented already--someone else must have run across this same problem?

Thanks for any help.
Gav Send private email
Thursday, September 28, 2006
I am not quite sure what you are asking but you can invoke:
javac -deprecation

But if you are saying that deprecating a method with Javadoc is goofey, you're right.  That's what annotations in Java 5 fix.
Bill Rushmore Send private email
Thursday, September 28, 2006
Maybe I wasn't clear enough in what we're trying to do...

The company has a policy that methods/classes should be deprecated for two releases before they're removed from the API.

I have two jar files, one from rel A and one from rel B, where B is 2 releases later than A.  The task is to find all the methods in A that aren't in B and check that each was deprecated in A first, and print out a list of the ones that disappeared without being deprecated first.

So it's sort of a compatibility checker, but most of the ones that already exist just flag methods that were removed, but don't check if they were deprecated first.  I'd like to automate that step as well.
Gav Send private email
Friday, September 29, 2006
I think I'm missing something...

If you have a list of all methods removed between versions of the code, then every method on that list should be considered depreciated.  It should be trivial to loop through that list and determine if it exists in the documentation as a depreciated method.

In practice, I think you would find it a lot more useful if it simply updated the documentation and automatically depreciated any method that's removed, regardless of whether it existed or not.
Friday, September 29, 2006
I think PMD does this.
John Haren Send private email
Thursday, October 05, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz