I have a method that I need to override and it returns a Parser<Node>
I have a DOTParser which is a Parser, but it doesn’t know Node.
How do I solve this?
override val parser: Parser<Node>
get() = ?
I have a method that I need to override and it returns a Parser<Node>
I have a DOTParser which is a Parser, but it doesn’t know Node.
How do I solve this?
override val parser: Parser<Node>
get() = ?
Does DOTParser
implement/extend Parser<Node>
?
Can you publish DOTParser
’s declaration?
Nope. They both are generated antlr parsers, but Parser<Node>
is an extended Parser with a Node that comes from another framework. As I am new to Kotlin, I don’t understand what Parser<Node>
stands for.
Somehow I need my DOTParser to become DOTParser<Node>
.
Just realized, it is not the same Parser. One is an interface declared in kotlin, the other is a superclass in java.
Ah, the old gotcha of two classes/interfaces with the same name but in different packages!⠀Well spotted — that can be really tricky to catch if you’re not used to it…
(Pro-tip: if there’s any strange behaviour with classes not being recognised, it’s always worth checking their fully-qualified names, justin case.)