melezov / proxykwai

Return type overloading for Scala
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Primitive return types clash #2

Open melezov opened 12 years ago

melezov commented 12 years ago

There will be problems whenever two methods are proxied under the same name with colliding primitive return types...

For instance:

parse(s: String): Long parse(s: String): Int

Will not work since compiler likes to promote Byte > Short > Int > Long

Currently, the only sane solution is to use boxed versions of primitives whenever a clash seems possible:

parse(s: String): java.lang.Long parse(s: String): java.lang.Integer

melezov commented 12 years ago

This seems like a show stopper for the primitive return type overriding, unless you only use primitive types which don't clash. ProxyKwai should detect when clashing primitive return types occur, and perform/advise on boxing...

To be continued...