Try.kotlin -> Kotlin Koans -> Builders -> Html Builders example does not compile with javascript(Canvas) configuration


#1

When attempting to compile the solution to the Kotlin Koans -> Builders -> Html Builders task using the Javascript(Canvas) configuration, the compiler complains about not finding ‘java’ in the import statement in ‘html.kt’.

https://try.kotlinlang.org/#/Kotlin%20Koans/Builders/Html%20builders/html.kt line 1

Chrome Version 63.0.3239.132 (Official Build) (64-bit) … Ubuntu 16.04.


#2

In short, the Java package does not exist in Javascript mode. You will have to do it in JVM mode for now. The class should just use children = mutableListOf<Tag>() and it would work by default. There is even a kotlin version of arraylist that will work in Javascript. If you want you can file a bug in youtrack to get this updated.