I am trying to parse a yaml in Kotlin using SnakeYAML following this tutorial:
data class Case(val args: List<String>, val expected: String, val score: Int)
data class TestCases(val target: String, val cases: List<Case>)
val yaml = Yaml(Constructor(TestCases::class.java))
but the code returns these errors in IntelliJ
Cannot access '<init>': it is public/*package*/ in 'Constructor'
for using Constructor
as in java.lang.reflect.Constructor
, and
None of the following functions can be called with the arguments supplied:
- public constructor Yaml(dumperOptions: DumperOptions!) defined in org.yaml.snakeyaml.Yaml
- public constructor Yaml(loadingConfig: LoaderOptions!) defined in org.yaml.snakeyaml.Yaml
- public constructor Yaml(constructor: BaseConstructor!) defined in org.yaml.snakeyaml.Yaml
- public constructor Yaml(representer: Representer!) defined in org.yaml.snakeyaml.Yaml
for using Yaml
as in org.yaml.snakeyaml.Yaml
, which I think is expecting a BaseConstructor
from Constructor
.
How can I fix this problem? Thank you.
Aucun commentaire:
Enregistrer un commentaire