On Wed, Jul 9, 2008 at 10:43 AM, David MacIver <
david.maciver@...> wrote:
> On Wed, Jul 9, 2008 at 9:01 AM, Sean McDirmid <
sean.mcdirmid@...> wrote:
>> The Scala compiler has done this for a while now. The type parameter
>> attributes are generated for Java and used from Java when the scalac
>> target flag is set to 1.5 (may be default now). Both Scala and Java
>> depend on erasure, so Scala type parameters are erased as usual and
>> only remain behind in the type parameter attribute section of the
>> classfile (just as in Java).
>
> I don't think this is true, at least in 2.7.1 (and I haven't seen
> anything in the commit logs to suggest it's true in trunk, but don't
> readily have a version for testing). I just ran some quick tests
> against both the standard library and freshly compiled code and
> couldn't see a single instance of Java being able to see type
> parameters defined in Scala. Are you sure you haven't misunderstood
> the question? The other direction works (Scala can see Java type
> parameters), but scalac still doesn't emit Java compatible generics
> information.
>
>> I deal with the Scala/Java integration problem by writing all my new
>> code in Scala. This is the easiest approach if you can stomache it. Of
>
> So do I. That doesn't solve all the problems, as there are a number of
> cases where it would be useful if the generic type information had the
> same reflective structure as it does in Java.
>