generic type not available to Java
Migrated from http://lampsvn.epfl.ch/trac/scala/ticket/3188
Reporter merlin-hst
After a (too) long discussion on the mailing list it looks like lists with generics are only availabe as raw lists to Java.
Here's a simple example:
Reporter merlin-hst
After a (too) long discussion on the mailing list it looks like lists with generics are only availabe as raw lists to Java.
Here's a simple example:
object ScUtil {
def getAList() : java.util.List[java.lang.Double] = {
return java.util.Arrays.asList(List(new java.lang.Double(0.0)):_*)
}
}
If I call this function from Java the return type is only List instead of List<Double>.public class ScTest {
public static void main(String[] args) {
List x4 = ScUtil.getAList();//better List<Double> }
}
Maybe the same is true for other collections or even all generic types but haven't test it. Because generics are one of the most important features in Java in my opinion it's very important to fix it.
Leave a comment
on 2010-03-18 08:01 *
By tracImporter
Trac author: merlin-hst
Maybe it's related to #3070
Maybe it's related to #3070
on 2010-03-18 08:09 *
By tracImporter
Trac author: merlin-hst
Scala Eclipse Plugin 2.8.0.r21209-b20100318035916
Default compiler settings
Eclipse 3.5.2 64-bit
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)
Windows 7 Prof. 64bit
Maven Integration for Eclipse 0.10.0.20100209-0800
Scala Eclipse Plugin 2.8.0.r21209-b20100318035916
Default compiler settings
Eclipse 3.5.2 64-bit
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)
Windows 7 Prof. 64bit
Maven Integration for Eclipse 0.10.0.20100209-0800
on 2010-03-18 11:12 *
By tracImporter
Closed As: duplicate