Hi,

I'm afraid there is no join point exposed for instanceof tests, so you
cannot write a pointcut to pick them out in the code.  Adding support for
this is something that has come up in the past but not many use cases have
been put forward, so it hasn't been implemented.  Actually I don't think we
are actually tracking an enhancement to add this feature - feel free to
raise one and add your use case.

cheers,
Andy.

2008/7/24 nicolas de loof <[EMAIL PROTECTED]>:

> Hello,
>
> Hello,
>
> I'd like to define an Aspect to detect use of "instanceOf" instruction in
> my business domain code.
> As I'm using Hibernate, the abstract @Entity class "Pet" cannot be casted
> to its child "Cat" due to Hibernate proxies :
>
> Pet felix = ....;
> if (felix instanceOf Cat) { // will always be false
>     Cat cat = (Cat) felix;  // will fail anyway
> }
>
>
> To avoid such error in code, I'd like to create an aspect to detect use of
> instanceOf with a class that is annotated with @Entity.
>
> As I'm not an aspectJ pointcut expression guru, I'd welcome any help ;-)
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to