@@ -586,59 +586,59 @@ private Builder(
586586 /**
587587 * Marks the {@code builder} as required and adds it to the command.
588588 *
589+ * @param <T> value type
589590 * @param name the name that will be inserted into the builder
590591 * @param builder the component builder
591592 * @return new builder instance with the command argument inserted into the argument list
592593 */
593- @ SuppressWarnings ({"rawtypes" })
594594 @ API (status = API .Status .STABLE )
595- public @ NonNull Builder <C > required (
595+ public < T > @ NonNull Builder <C > required (
596596 final @ NonNull String name ,
597- final CommandComponent .@ NonNull Builder builder
597+ final CommandComponent .@ NonNull Builder <? super C , T > builder
598598 ) {
599599 return this .argument (builder .name (name ).required ());
600600 }
601601
602602 /**
603603 * Marks the {@code builder} as optional and adds it to the command.
604604 *
605+ * @param <T> value type
605606 * @param name the name that will be inserted into the builder
606607 * @param builder the component builder
607608 * @return new builder instance with the command argument inserted into the argument list
608609 */
609- @ SuppressWarnings ({"rawtypes" })
610610 @ API (status = API .Status .STABLE )
611- public @ NonNull Builder <C > optional (
611+ public < T > @ NonNull Builder <C > optional (
612612 final @ NonNull String name ,
613- final CommandComponent .@ NonNull Builder builder
613+ final CommandComponent .@ NonNull Builder <? super C , T > builder
614614 ) {
615615 return this .argument (builder .name (name ).optional ());
616616 }
617617
618618 /**
619619 * Marks the {@code builder} as required and adds it to the command.
620620 *
621+ * @param <T> value type
621622 * @param builder the component builder
622623 * @return new builder instance with the command argument inserted into the argument list
623624 */
624- @ SuppressWarnings ({"rawtypes" })
625625 @ API (status = API .Status .STABLE )
626- public @ NonNull Builder <C > required (
627- final CommandComponent .@ NonNull Builder builder
626+ public < T > @ NonNull Builder <C > required (
627+ final CommandComponent .@ NonNull Builder <? super C , T > builder
628628 ) {
629629 return this .argument (builder .required ());
630630 }
631631
632632 /**
633633 * Marks the {@code builder} as optional and adds it to the command.
634634 *
635+ * @param <T> value type
635636 * @param builder the component builder
636637 * @return new builder instance with the command argument inserted into the argument list
637638 */
638- @ SuppressWarnings ({"rawtypes" })
639639 @ API (status = API .Status .STABLE )
640- public @ NonNull Builder <C > optional (
641- final CommandComponent .@ NonNull Builder builder
640+ public < T > @ NonNull Builder <C > optional (
641+ final CommandComponent .@ NonNull Builder <? super C , T > builder
642642 ) {
643643 return this .argument (builder .optional ());
644644 }
@@ -1188,12 +1188,13 @@ private Builder(
11881188 * @param argument argument to add
11891189 * @return new builder instance with the command argument inserted into the argument list
11901190 */
1191+ @ SuppressWarnings ("unchecked" )
11911192 @ API (status = API .Status .STABLE )
11921193 public @ NonNull Builder <C > argument (
1193- final @ NonNull CommandComponent <C > argument
1194+ final @ NonNull CommandComponent <? super C > argument
11941195 ) {
11951196 final List <CommandComponent <C >> commandComponents = new ArrayList <>(this .commandComponents );
1196- commandComponents .add (argument );
1197+ commandComponents .add (( CommandComponent < C >) argument );
11971198 return new Builder <>(
11981199 this .commandManager ,
11991200 this .commandMeta ,
@@ -1209,16 +1210,17 @@ private Builder(
12091210 /**
12101211 * Adds the given {@code argument} to the command.
12111212 *
1213+ * @param <T> value type
12121214 * @param builder builder that builds the component to add
12131215 * @return new builder instance with the command argument inserted into the argument list
12141216 */
12151217 @ SuppressWarnings ({"unchecked" , "rawtypes" })
12161218 @ API (status = API .Status .STABLE )
1217- public @ NonNull Builder <C > argument (
1218- final CommandComponent .Builder builder
1219+ public < T > @ NonNull Builder <C > argument (
1220+ final CommandComponent .Builder <? super C , T > builder
12191221 ) {
12201222 if (this .commandManager != null ) {
1221- return this .argument (builder .commandManager (this .commandManager ).build ());
1223+ return this .argument ((( CommandComponent . Builder ) builder ) .commandManager (this .commandManager ).build ());
12221224 } else {
12231225 return this .argument (builder .build ());
12241226 }
0 commit comments