This problem is linked to this issue.
I tried implementing Brigadier, but if i try to create my argumentbuilder structure there is an exception.
The problem is that the generic information of the CommandDispatcher isn't passed to the added child-argumentbuilder
You can simplify the problem to theese few lines of code:
public class Main {
public static void main(String[] args) {
Node.<String>node().addChild(
Node.node().addChild(
Node.node()
)
);
}
private static class Node<S> {
public static <S> Node<S> node() {
return new Node<>();
}
public Node<S> addChild(Node<S> node) {
return this;
}
}
}
If i try to execute this i get a compiler error saying: error: incompatible types: Node<Object> cannot be converted to Node<String>
Its obvious that my child node doesn't get the generic Type S from the root node and i think it is because of type erasure.
I am using Java 17 and because brigadier is written in java 8 i changed my java version to 8 but it doesn't work too.
I just don't understand how it can work for all the other devs using brigadier, has somebody a solution for that?
This problem is linked to this issue.
I tried implementing Brigadier, but if i try to create my argumentbuilder structure there is an exception.
The problem is that the generic information of the CommandDispatcher isn't passed to the added child-argumentbuilder
You can simplify the problem to theese few lines of code:
If i try to execute this i get a compiler error saying:
error: incompatible types: Node<Object> cannot be converted to Node<String>Its obvious that my child node doesn't get the generic Type S from the root node and i think it is because of type erasure.
I am using Java 17 and because brigadier is written in java 8 i changed my java version to 8 but it doesn't work too.
I just don't understand how it can work for all the other devs using brigadier, has somebody a solution for that?