Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
548 stars 44 forks source link

StackOverflowError #490

Open triplem opened 2 years ago

triplem commented 2 years ago

In the kotlin-js-plugin (1.6.21) I am starting the generateExternalsIntegrated and get the following Exception for several packages (trying each alone) react-hook-form or formik. Any help would be appreciated.

My gradle.build.kts contains the following dependencies:

implementation(npm("formik", "2.2.9", generateExternals = true))

or implementation(npm("react-hook-form", "7.31.1", generateExternals = true))

> Task :generateExternalsIntegrated
Exception in thread "main" java.lang.StackOverflowError
    at kotlin.collections.CollectionsKt__IterablesKt.collectionSizeOrDefault(Iterables.kt:39)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNodeNullable(convertTypeDeclarations.kt:110)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode(convertTypeDeclarations.kt:107)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode$default(convertTypeDeclarations.kt:106)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNodeNullable(convertTypeDeclarations.kt:92)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode(convertTypeDeclarations.kt:107)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode$default(convertTypeDeclarations.kt:106)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNodeNullable(convertTypeDeclarations.kt:69)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode(convertTypeDeclarations.kt:107)
    at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode$default(convertTypeDeclarations.kt:106)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process(introduceModels.kt:350)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process$default(introduceModels.kt:323)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter$convertMeta$1.invoke(introduceModels.kt:276)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter$convertMeta$1.invoke(introduceModels.kt:181)
    at kotlin.text.StringsKt__AppendableKt.appendElement(Appendable.kt:85)
    at kotlin.collections.CollectionsKt___CollectionsKt.joinTo(_Collections.kt:3304)
    at kotlin.collections.CollectionsKt___CollectionsKt.joinToString(_Collections.kt:3321)
    at kotlin.collections.CollectionsKt___CollectionsKt.joinToString$default(_Collections.kt:3320)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.convertMeta(introduceModels.kt:275)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process(introduceModels.kt:336)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process(introduceModels.kt:355)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process$default(introduceModels.kt:323)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process(introduceModels.kt:350)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process$default(introduceModels.kt:323)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter$convertMeta$1.invoke(introduceModels.kt:276)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter$convertMeta$1.invoke(introduceModels.kt:181)
bobhy commented 1 year ago

Check the failing libraries for a wild-card import like import * as _alias_ from _package_, like import * as React from "react" and see my fuller description below: https://github.com/Kotlin/dukat/issues/482#issuecomment-1321433556; you may have an easy, though hacky, workaround.