Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to declare an error when implementations of an interface doesn't supply a certain constructor


Hidehiko,

This will not work because you are trying to advise the _absence_ of a join point, i.e. the constructor with a particular signature, which is not possible. You can think of a declare error/warning as advice that executes at compile time. There is no joint point with which to associate the advice.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

http://w3.hursley.ibm.com/~websterm/

Please respond to Hidehiko Masuhara <masuhara@xxxxxxxxxxxxxxxxxxxxx>; Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        aspectj-users@xxxxxxxxxxx
cc:        
Subject:        Re: [aspectj-users] How to declare an error when implementations of        an interface doesn't supply a certain constructor


My apologies to for my previous message, which is accidentally sent to
the entire list.  But I thought that the problem might be solved by
our extended AspectJ compiler (called SCoPE), which allows you to
write declarations by using if-pointcut like:
 declare error: staticinitialization(...) &&
if(thisJoinPoint.getSignature()....)

I'd like to send our solution again when we find the way to do it.
More information on SCoPE can be found from the follwing address:
http://www.graco.c.u-tokyo.ac.jp/ppp/projects/scope/

Best regards,

Hidehiko

2006/1/12, Jeppe Cramon <jeppe@xxxxxxxxx>:
> Hi
>
> I'm trying to declare an error when implementations of a certain
> interface doesn't supply a certain constructor.
> I'm both having difficulty limiting the scope to only implementations of
> the interface (IOpen+) seems too large a granularity and specifying the
> constructor.
>
> I've tried with this aspect:
>
> public aspect OptionAspect {
>     declare error: staticinitialization(IOption+) &&
> !execution(IOption+.new(OptionType)) : "IOption implementations must
> provide a constructor which accepts an OptionType";
> }
>
> Could you give me a pointer to what I'm missing/doing wrong?
>
> Thanks in advance :)
>
> /Jeppe
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top