-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree-Structure does not inherit generics #112
Comments
I know that it works if you specify the generic type S in every single child, but this reduces code readability a lot if your generic type has many letters. In the examples given in the readme it works without specifying the generic type in every single child... i understand why it doesn't work but i wonder why it works for all the other people and devs using brigadier... |
On new MC versions there are public class BrigadierExtensions {
public static LiteralArgumentBuilder<ServerCommandSender> literal(String name) {
return LiteralArgumentBuilder.literal(name);
}
public static <T> RequiredArgumentBuilder<ServerCommandSender, T> argument(final String name, final ArgumentType<T> type) {
return RequiredArgumentBuilder.argument(name, type);
}
} After I made this I had no need to declare my command and arguments explicitly before |
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?
The text was updated successfully, but these errors were encountered: