utopia-rise/godot-kotlin-native

Cannot construct Godot's File object

piiertho opened this issue · 3 comments

Version:

0.1.0-3.2

OS/device including version:

OSX 10.15.3

Issue description:

NotImplementedError is thrown when trying to call File's constructor:

kotlin.NotImplementedError: There is no constructor for class File in GD
        at 0   libkotlin.dylib                     0x00000001264be727 kfun:kotlin.Throwable.<init>(kotlin.String?)kotlin.Throwable + 87 (/Users/teamcity3/buildAgent/work/4d622a065c544371/runtime/src/main/kotlin/kotlin/Throwable.kt:22:37)
        at 1   libkotlin.dylib                     0x00000001264b89f5 kfun:kotlin.Error.<init>(kotlin.String?)kotlin.Error + 85 (/Users/teamcity3/buildAgent/work/4d622a065c544371/runtime/src/main/kotlin/kotlin/Exceptions.kt:12:44)
        at 2   libkotlin.dylib                     0x00000001264b37a5 kfun:kotlin.NotImplementedError.<init>(kotlin.String)kotlin.NotImplementedError + 85 (/Users/teamcity3/buildAgent/work/4d622a065c544371/backend.native/build/stdlib/kotlin/util/Standard.kt:15:90)
        at 3   libkotlin.dylib                     0x00000001264fa8ae kfun:godot.GodotObject.<init>$godot-library(kotlin.String)godot.GodotObject + 1102 (/Users/piertho/git/kotlin-godot-wrapper/wrapper/godot-library/src/main/kotlin/godot/GodotObject.kt:32:28)
        at 4   libkotlin.dylib                     0x000000012687c0c5 kfun:godot.Object.<init>$godot-library(kotlin.String)godot.Object + 85 (/Users/piertho/git/kotlin-godot-wrapper/wrapper/godot-library/src/main/kotlin/godot/generated/godot/Object.kt:164:40)
        at 5   libkotlin.dylib                     0x0000000126901215 kfun:godot.Reference.<init>$godot-library(kotlin.String)godot.Reference + 85 (/Users/piertho/git/kotlin-godot-wrapper/wrapper/godot-library/src/main/kotlin/godot/generated/godot/Reference.kt:29:40)
        at 6   libkotlin.dylib                     0x000000012673092e kfun:godot.File.<init>()godot.File + 62 (/Users/piertho/git/kotlin-godot-wrapper/wrapper/godot-library/src/main/kotlin/godot/generated/godot/File.kt:177:19)
        at 7   libkotlin.dylib                     0x0000000126be7406 kfun:godot.samples.games.dodge.Main._ready() + 2774 (/Users/piertho/git/kotlin-godot-wrapper/samples/games/kotlin/src/main/kotlin/godot/samples/games/dodge/Main.kt:39:20)
        at 8   libkotlin.dylib                     0x0000000126bb3c2b kfun:org.godotengine.kotlin.functionBridge13$lambda-102#internal + 971 (/Users/piertho/git/kotlin-godot-wrapper/samples/games/kotlin/build/godot/entries/org/godotengine/kotlin/Entry.kt:1055:17)
        at 9   libkotlin.dylib                     0x0000000126bdf7ea _knbridge210 + 90 (/Users/piertho/git/kotlin-godot-wrapper/samples/games/kotlin/build/godot/entries/org/godotengine/kotlin/Entry.kt:1050:10)
        at 10  libkotlin.dylib                     0x0000000126e92cf7 ___godot_wrapper_call_and_get + 87
        at 11  Godot                               0x0000000109a53543 _ZN20NativeScriptInstance17_ml_call_reversedEP16NativeScriptDescRK10StringNamePPK7Varianti + 179
        at 12  Godot                               0x0000000109a55659 _ZN20NativeScriptInstance24call_multilevel_reversedERK10StringNamePPK7Varianti + 185
        at 13  Godot                               0x000000010bd93bf3 _ZN6Object12notificationEib + 19
        at 14  Godot                               0x000000010ad9f37b _ZN4Node16_propagate_readyEv + 171
        at 15  Godot                               0x000000010ada4b04 _ZN4Node18_add_child_nocheckEPS_RK10StringName + 180
        at 16  Godot                               0x000000010a559812 _ZN11MethodBind1IP4NodeE4callEP6ObjectPPK7VariantiRNS5_9CallErrorE + 322
        at 17  Godot                               0x000000010bd97155 _ZN6Object4callERK10StringNamePPK7VariantiRNS3_9CallErrorE + 357
        at 18  Godot                               0x000000010bd89b6a _ZN12MessageQueue14_call_functionEP6ObjectRK10StringNamePK7Variantib + 442
        at 19  Godot                               0x000000010bd89e50 _ZN12MessageQueue5flushEv + 224
        at 20  Godot                               0x000000010add4c94 _ZN9SceneTree9iterationEf + 612
        at 21  Godot                               0x0000000109794e23 _ZN4Main9iterationEv + 531
        at 22  Godot                               0x0000000109766417 _ZN6OS_OSX3runEv + 391
        at 23  Godot                               0x000000010976b321 main + 529
        at 24  libdyld.dylib                       0x00007fff633397fd start + 1

Steps to reproduce:

Create a script which call File constructor.

Minimal reproduction project:

Can be easily done in sample.

The problem is that we call constructor from GDNative with new generated name (ie File instead of _File), which is not in godot's ClassDB.
We should have the problem with those classes too:
image

Waiting eagerly on this fix 😆

Yep, I fix it as soon as stuff with beta release are ok. This fix should not take much time :)