Brian Frank a écrit :
> Since the JVM Summit I've been inspired to play around with interop
> strategies.  One of things I've been trying to leverage is javac's
> support for auto-boxing when calling against alternate language
> libraries.  Consider this code:
>
>   static Long foo(Long a, Long b)
>   {
>     return Long.valueOf(a.longValue() + b.longValue());
>   }
>
>   long x = foo(3L, 4L);    // works
>   long x = foo(3, 4);       // doesn't work
>
> I'm surprised that javac doesn't allow both a widening and auto-boxing
> conversion in this case.
>
> Is this by design?
>   
yes, boxing conversion are done before primitive conversion.

See JLS 5.17 and 5.1.8.
see 
http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7

Rémi

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to