[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Generics in AJ5
|
Hi!
I was re-reading the Chapter 3: Generics in AspectJ 5 and I have some questions that I wasn't able
to clarify:
1/
[quote]
AspectJ 5 does not allow the use of type variables in pointcut expressions and type patterns.
Instead, members that use type parameters as part of their signature are matched by their erasure.
[/quote]
isn't this conflicting with:
[quote]
Pointcut matching can be further restricted to match only given parameterizations of parameter types
(methods and constructors), return types (methods) and field types (fields). This is achieved by
specifying a parameterized type pattern at the appropriate point in the signature pattern.
[/quote]
[self answering]
you cannot write:
pointcut nameType(): get(List<T> Foo.myStrings)
but you can write:
pointcut nameParametrized(): get(List<String> Foo.myStrings)
2/
[quote]
execution(* C.*(List<? extends Object+>))
matches both the execution of foo and the execution of bar since the upper bound of List<?> is
implicitly Object.
[/quote]
Q1: isn't enought in the pointcut to say List<? extends Object>
Q2: upper bound of List<?> is not List? (my understanding of generics may be weak here but what is
the difference between List<?> and List<T>?)
Some small corrections to the document:
1/
[quote]
(List<String>, List<?>, List<? extends Number> and so on.
[/quote]
should be
[quote]
(List<String>, List<?>, List<? extends Number> and so on).
[/quote]
2/
[quote]
class G<T> {
List<T> foo(List<String ls) { return null; }
}
[/quote]
should be
[quote]
class G<T> {
List<T> foo(List<String> ls) { return null; }
}
[/quote]
thanks for your time,
:alex |.::the_mindstorm::.|