Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
554 stars 42 forks source link

NumberFormatException occurs when parsing numeric literals with decimal point #487

Open mysticfall opened 2 years ago

mysticfall commented 2 years ago

๐Ÿ•— Version

0.5.8-rc.4

๐Ÿ’ป Code or Package Name

org.jetbrains.dukat.nodeIntroduction

๐Ÿ™ Actual behavior

If you try to generate Kotlin API wrappers for @babylonjs/core, it will fail with the following exception:

Exception in thread "main" java.lang.NumberFormatException: For input string: "1.5"
    at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.base/java.lang.Integer.parseInt(Integer.java:652)
    at java.base/java.lang.Integer.parseInt(Integer.java:770)
    at org.jetbrains.dukat.nodeIntroduction.ExpressionConverter.convert(convertStatements.kt:129)
    at org.jetbrains.dukat.nodeIntroduction.ExpressionConverter.convert(convertStatements.kt:243)
    at org.jetbrains.dukat.nodeIntroduction.ExpressionConverter.convertExpression(convertStatements.kt:601)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.process(introduceModels.kt:523)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.processMembers(introduceModels.kt:271)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.convertToClassModel(introduceModels.kt:668)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.convertToModel(introduceModels.kt:728)
    at org.jetbrains.dukat.nodeIntroduction.DocumentConverter.convert(introduceModels.kt:201)
    at org.jetbrains.dukat.nodeIntroduction.NodeConverter.convert(introduceModels.kt:871)
    at org.jetbrains.dukat.nodeIntroduction.IntroduceModelsKt.introduceModels(introduceModels.kt:930)
    at org.jetbrains.dukat.ts.translator.TypescriptLowerer.lower(TypescriptLowerer.kt:98)
    at org.jetbrains.dukat.ts.translator.JsRuntimeByteArrayTranslator.lower(JsRuntimeByteArrayTranslator.kt:13)
    at org.jetbrains.dukat.ts.translator.JsRuntimeByteArrayTranslator.translate(JsRuntimeByteArrayTranslator.kt:21)
    at org.jetbrains.dukat.ts.translator.TranslateTypescriptDeclarationsKt.translateTypescriptDeclarations(translateTypescriptDeclarations.kt:10)
    at org.jetbrains.dukat.cli.CliKt.main(cli.kt:255)

๐Ÿ™‚ Expected behavior

API wrappers get generated as expected.