|
42 | 42 | import cloud.commandframework.arguments.standard.StringArrayArgument; |
43 | 43 | import cloud.commandframework.arguments.standard.UUIDArgument; |
44 | 44 | import cloud.commandframework.context.CommandContext; |
| 45 | +import io.leangen.geantyref.AnnotatedTypeMap; |
45 | 46 | import io.leangen.geantyref.GenericTypeReflector; |
46 | 47 | import io.leangen.geantyref.TypeToken; |
47 | 48 | import java.lang.annotation.Annotation; |
| 49 | +import java.lang.reflect.AnnotatedType; |
48 | 50 | import java.time.Duration; |
49 | 51 | import java.util.Arrays; |
50 | 52 | import java.util.Collection; |
@@ -85,7 +87,7 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> { |
85 | 87 | }; |
86 | 88 |
|
87 | 89 | private final Map<String, Function<ParserParameters, ArgumentParser<C, ?>>> namedParsers = new HashMap<>(); |
88 | | - private final Map<TypeToken<?>, Function<ParserParameters, ArgumentParser<C, ?>>> parserSuppliers = new HashMap<>(); |
| 90 | + private final Map<AnnotatedType, Function<ParserParameters, ArgumentParser<C, ?>>> parserSuppliers = new AnnotatedTypeMap<>(); |
89 | 91 | private final Map<Class<? extends Annotation>, BiFunction<? extends Annotation, TypeToken<?>, ParserParameters>> |
90 | 92 | annotationMappers = new HashMap<>(); |
91 | 93 | private final Map<String, BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<String>>> |
@@ -195,7 +197,7 @@ public <T> void registerParserSupplier( |
195 | 197 | final @NonNull Function<@NonNull ParserParameters, |
196 | 198 | @NonNull ArgumentParser<C, ?>> supplier |
197 | 199 | ) { |
198 | | - this.parserSuppliers.put(type, supplier); |
| 200 | + this.parserSuppliers.put(type.getAnnotatedType(), supplier); |
199 | 201 | } |
200 | 202 |
|
201 | 203 | @Override |
@@ -248,7 +250,7 @@ public <A extends Annotation, T> void registerAnnotationMapper( |
248 | 250 | } else { |
249 | 251 | actualType = type; |
250 | 252 | } |
251 | | - final Function<ParserParameters, ArgumentParser<C, ?>> producer = this.parserSuppliers.get(actualType); |
| 253 | + final Function<ParserParameters, ArgumentParser<C, ?>> producer = this.parserSuppliers.get(actualType.getAnnotatedType()); |
252 | 254 | if (producer == null) { |
253 | 255 | /* Give enums special treatment */ |
254 | 256 | if (GenericTypeReflector.isSuperType(Enum.class, actualType.getType())) { |
|
0 commit comments