0
をコンパイルしないのですか?エラーが返さ文字列:: toByteArray()は、次のコードは、KotlinのJSにコンパイルされませんKotlinに[JS]
は次のとおりです。
[INFO]
[INFO] --- kotlin-maven-plugin:1.1.51:js (compile-js) @ client ---
[INFO] Kotlin version 1.1.51 (JRE 1.8.0_144-b01)
[INFO] Compiling Kotlin sources from [C:\myproject\src\main\kotlin]
[ERROR] C:\myproject\src\main\kotlin\mypackage\MyFile.kt: (15, 48) Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun Array<out Byte>.toByteArray(): ByteArray defined in kotlin.collections
public fun Collection<Byte>.toByteArray(): ByteArray defined in kotlin.collections
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
同じコードが非ジャバスクリプトKotlinのコンパイルでコンパイルされます。
[INFO] --- kotlin-maven-plugin:1.1.51:compile (compile) @ client ---
[INFO] Kotlin version 1.1.51 (JRE 1.8.0_144-b01)
[INFO] Compiling Kotlin sources from [C:\myproject\src\main\kotlin, C:\myproject\src\main\java]
[INFO] Module name is client
[INFO]
'String.toByteArray()'は 'kotlin-stdlib' /' kotlin-text'に由来します。それについての参考資料がありますか?このページによると:https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-byte-array.html – cramopy