timowest / scalagen

Java to Scala transformation
Apache License 2.0
216 stars 32 forks source link

Fields/methods from boxed primitives don't compile #54

Closed dnadolny closed 10 years ago

dnadolny commented 11 years ago

If you have the java double d = Double.MAX_VALUE;, converting it gives val d = Double.MAX_VALUE, which doesn't compile because in Java an unqualified Double means java.lang.Double, but in Scala it means scala.Double which doesn't have a MAX_VALUE field, instead it has a MaxValue field.

This is the same with many other boxed primitives (Float, Byte, Short, etc), and any methods on them that are not present in Scala's version (eg Double.doubleToLongBits(1.0)).

There could be special cases for these fields and methods to replace them with the Scala equivalent when present, or to change unqualified Double/Float/etc to be fully qualified with java.lang otherwise.

timowest commented 10 years ago

Released in 0.3.1