Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Understanding generic types in args(..) construction

Ah yes, you are right. I forgot about the runtime checks. Indeed it
seems that cast conversion seems to be the right thing here.

Thanks for the clarification!

Eric

2008/11/4 Bruno De Fraine <Bruno.De.Fraine@xxxxxxxxx>:
> Hello Eric,
>
> On 4-nov-08, at 04:16, Eric Bodden wrote:
>
>>>> 2) args() should have matching behavior closely related to "casting
>>>> conversion" in Java:
>>>>
>>>> http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.5
>>>
>>> Yes, I don't see what an alternative behaviour could be.
>>
>> Shouldn't it rather be assignment conversion?
>>
>> http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#184206
>>
>> I think casting conversion would be wrong in that setting.
>
>
> Assignment conversion is basically the identity/widening conversion. Casting
> conversion adds the case of narrowing conversion, which in general requires
> a runtime test. When I say the behavior of args() is _related to_ casting
> conversion, then I don't mean it should do a cast implicitly. Instead, it
> works like this: when the conversion is identity/widening, the cast would
> not require runtime behavior, and correspondingly, args() can just match
> statically. In case of a narrowing conversion, the cast would normally
> require a runtime test, and args() should use the same runtime test to
> determine matching (so while a cast would fail with an exception at runtime,
> args() will not match instead).
>
> This behavior has been the case before Generics as well:
>
> void m(Number n) -> join point
> args(Object) -> widening, match statically
> args(Integer) -> narrowing, runtime test
> args(String) -> unrelated, don't match
>
> Bruno
>
> --
> Bruno De Fraine
> Vrije Universiteit Brussel
> Faculty of Applied Sciences, DINF - SSEL
> Room 4K208, Pleinlaan 2, B-1050 Brussels
> tel: +32 (0)2 629 29 75
> fax: +32 (0)2 629 28 70
> e-mail: Bruno.De.Fraine@xxxxxxxxx
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>



-- 
Eric Bodden
Sable Research Group, McGill University, Montréal, Canada
Got an interesting job offer? http://www.bodden.de/hire-me/


Back to the top