Open OndrejSpanel opened 6 years ago
I'm not quite sure how this is supposed to work.
For example, the compiler doesn't even know what type the imported Vector2f is:
println(manifest[Vector2f])
Yields the errors:
Error:(41, 21) No Manifest available for Abstract.Link.Vector2f.
println(manifest[Vector2f])
It knows what the type is supposed to be if your link doesn't cast to the super:
object Abstract {
val Link = Concrete
}
Or
object Abstract {
val Link: Concrete.type = Concrete
}
The only way that the compiler is figuring out how to construct an XY in val input = Container(Vector2f(0,0))
is because of the companion object that you've fabricated to get around the fact that the type is unknown in the abstract class.
I think you're going to want to approach this problem from another angle. Is this something you're still trying to work on?
Deserialization fails in an unexpected way in following code. No exception is thrown, however
from
field ofContainer
is deserialized asMap
instead ofXY
, the program outputs:This happens only if the
Vector2f
is used asimport Abstract.Link.Vector2f
. Once you change it toConcrete.Vector2f
it works fine.