Just want to 100% understand your requirement:

> I want to find which classes and methods  outside our application that calls 
> to our application classes with public methods that has annotation 
> @Deprecated.

You want to find calls to your API *from* code marked @Deprecated or you want 
to find calls made *to* @Deprecated code?

If you mean the latter then your pointcut isn’t quite right.


> pointcut deprecatedMethods() : call(public * *.*(..)) && 
> @withincode(Deprecated);

This says “match calls made to public methods *from* code marked @Deprecated”.

If you want to match calls *to* deprecated methods it would be more like:

“call(public * *(..)) && @annotation(Deprecated)”

In this second case the enclosingjoinpoint would be the Demo.test and the 
target of the call would be the deprecated method getBoards().

Is that any help?

cheers,
Andy


> On Sep 18, 2017, at 6:27 AM, Mikael Petterson <[email protected]> 
> wrote:
> 
> Hi,
> 
> I have started to look into aspectj , now that I have a working dev 
> environment in Eclipse 😊
> 
> I want to find which classes and methods  outside our application that calls 
> to our application classes with public methods that has annotation 
> @Deprecated.
> 
> I have created the following 'pointcut':
> 
> pointcut deprecatedMethods() : call(public * *.*(..)) && 
> @withincode(Deprecated);
>     before() : deprecatedMethods() {
>       log("[Deprecated Method Usage]" +" --> "+ 
> thisEnclosingJoinPointStaticPart.getSignature().toShortString+"\n");
> 
>     }
> 
> The above will give something like:
> 
> [Deprecated Method Usage] --> HandlerImpl.getBoards(..)
> 
>  I can see which classes' methods with @Deprecated gets called. But I cannot 
> see  what the name of the enclosing class and method is, in this case 
> Demo.test() ( see below).
> 
> Is it possible to get this using aspectj?
> What would be the correct pointcut to use?
> 
> br.
> 
> //mike
> 
> 
> public class Demo extends Test{
> 
>     @Test
>     public void test() {
>       Node node = new Node();
>       Handler handler = node.getObjectHandler();
>       //getBoards() is the deprecated method.
>       Boards boards = handler.getBoards();
>       
>  
>     }
> }
> 
> 
>  
>  
> _______________________________________________
> aspectj-users mailing list
> [email protected] <mailto:[email protected]>
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users 
> <https://dev.eclipse.org/mailman/listinfo/aspectj-users>
_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to