1c-syntax / bsl-language-server

Реализация Language Server Protocol для языка 1C (BSL)
https://1c-syntax.github.io/bsl-language-server
Other
299 stars 105 forks source link

[BUG] Ошибка при разборе JSON-файла, содержащего настройки диагностики CommentedCode #1665

Closed bapho-bush closed 3 years ago

bapho-bush commented 3 years ago

Диагностика

CommentedCode

Версия

Плагин версии 1.8.1

Описание ошибки диагностики

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'diagnostics' defined in class path resource [com/github/_1c_syntax/bsl/languageserver/diagnostics/infrastructure/DiagnosticsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.List]: Factory method 'diagnostics' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'diagnostic' defined in class path resource [com/github/_1c_syntax/bsl/languageserver/diagnostics/infrastructure/DiagnosticConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github._1c_syntax.bsl.languageserver.diagnostics.BSLDiagnostic]: Factory method 'diagnostic' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commentedCodeDiagnostic' defined in URL [jar:file:/home/runner/.sonar/cache/7959bff7d2df378f7bed542287a4eb97/sonar-communitybsl-plugin.jar!/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.class]: Initialization of bean failed; nested exception is java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Float (java.lang.Integer and java.lang.Float are in module java.base of loader 'bootstrap')

Пример кода

До кода дело не доходит. Ошибка появляется на этапе разбора JSON-файла.

Скриншоты

изображение

Дополнительная информация

Пример JSON-файла, на котором поймал ошибку, - https://gist.github.com/bapho-bush/db96d4ca26ab94dae2387795d38e6a46

asosnoviy commented 3 years ago
{
  "$schema": "https://raw.githubusercontent.com/1c-syntax/bsl-language-server/master/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json",
  "language": "ru",
  "diagnostics": {
    "parameters": {
      "LineLength": {
        "maxLineLength": 150
      },
      "CognitiveComplexity": {
        "complexityThreshold": 30,
        "checkModuleBody": true
      },
      "CyclomaticComplexity": {
        "complexityThreshold": 30
      },
      "MissingSpace": {
        "allowMultipleCommas": true
      },
      "IfElseDuplicatedCodeBlock": false,
      "IfElseIfEndsWithElse": false,
      "NumberOfOptionalParams": {
        "maxOptionalParamsCount": 5
      },
      "GetFormMethod": false,
      "MissingSpace": false,
      "CommonModuleInvalidType": false,
      "CommentedCode": {
        "threshold": 0.9
      }
    }
  }
}
asosnoviy commented 3 years ago

Параметр float и падает на касте =(