[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Re: Simplification of generic / parameterized type matching in pointcut expressions
|
We considered that simplification. The problem then becomes when you
bind arguments in advice:
For example:
before(List l) : execution(String shead(List)) && args(l) {
// here we have to work with the raw type list inside the advice body
// and lose the nicely typed collections that Java gives us
String s = (String) l.first();
...
}
As opposed to:
before(List<String> ls) : execution(String shead(List<String>)) && args(l) {
// now we can continue working with the typed collection...
String s = ls.first();
}
Being unable to work with parameterized type information inside advice
felt like a bridge too far, hence support for List<String>...
On 01/08/05, Shigeru Chiba <chiba@xxxxxxxxxxxxxxx> wrote:
> Thanks for your reply.
>
> So,
>
> class List<T> {
> T value;
> List<T> next;
> static T thead(List<T> list) { return list.value; }
> static String shead(List<String> list) { return list.value; }
> }
>
> The issue is that the signature of thead() is "Object thead(List)" but
> the signature of shead() is "String shead(List<String>)". I thought
> this distinction is a bit confusing. A extremely simple solution
> might be to use only the erasure type "List" for both List<T> and
> List<String>.
> So the signature of shead is now "String shead(List)". This
> simplification
> would make it easy to understand AspectJ 5 although it would also be too
> simple for practice.
>
> Best regards,
>
> Chiba
--
-- Adrian
adrian.colyer@xxxxxxxxx