While converting an existing code base to run in Javascript, I've encountered this bug many times. It often manifests itself after using functional methods in Lists and Maps which, by default, return Obj?.
Example:
class Example {
Int:Str strs := [:]
Void main() {
ints := Int:Int?[1:1, 2:2]
strs = ints.map { it.toStr }
// --> sys::CastErr: [sys::Int:sys::Obj?] cannot be cast to [sys::Int:sys::Str]
}
}
The current workaround is, one-by-one, convert the functions to use a full signature:
SlimerDude Sat 5 Sep 2015
Hi, I found some differences in how Javascript handles nullable List and Map types:
And the following raises an Err in Javascript (but is fine in Java's runtime):
It may look inconspicuous but it also occurs when using default method params:
Or even:
SlimerDude Wed 9 Sep 2015
While converting an existing code base to run in Javascript, I've encountered this bug many times. It often manifests itself after using functional methods in
Lists
andMaps
which, by default, returnObj?
.Example:
The current workaround is, one-by-one, convert the functions to use a full signature:
andy Wed 9 Sep 2015
Ticket promoted to #2453 and assigned to andy
SlimerDude Wed 9 Sep 2015
I suspect this is the same down cast problem; when you call
TabPane.tabs()
in Javascript you get:The following workaround patch fixes it:
SlimerDude Tue 20 Oct 2015
A quick test and a fix for the JS casting bugs:
andy Thu 22 Oct 2015
Ticket resolved in 1.0.68
That seems pretty safe - pushed