Community Forums

Share Queries => Cool queries => Topic started by: sunny on April 01, 2008, 09:46:00 am



Title: Deprecated methods
Post by: sunny on April 01, 2008, 09:46:00 am
Hello,
I should looking for deprecated methods in a project. Has anyone an idea how to write a good query?
Thank you very much
Greetings
Sandra


Title: Re: Deprecated methods
Post by: Mathieu Verbaere on April 02, 2008, 01:35:48 pm
Hi Sandra,

The following query will give you all methods and constructors annotated with @Deprecated:

Code:
from Callable c
where c.getAnAnnotation().getType().hasName("Deprecated")
select c.getDeclaringType(), c

It won't give you, however, elements whose Javadoc contains a tag @deprecated. We are preparing a version of SemmleCode that populates Javadoc, which will allow to spot those too. Thanks for bearing with us.