Incendo / cloud

Command framework & dispatcher for the JVM
https://cloud.incendo.org
MIT License
433 stars 54 forks source link

Fix infinite recursion when a `@Suggestions` method returns a `CompletableFuture` #771

Closed emilyy-dev closed 1 month ago

emilyy-dev commented 1 month ago

MethodSuggestionProvider#mapSuggestions calls itself when the method's input (the @Suggestions method return value) is a CompletableFuture, instead of the unused #mapFuture, leading to a StackOverflowError.

github-actions[bot] commented 1 month ago

Test Results

 88 files  ±0   88 suites  ±0   10s :stopwatch: -4s 429 tests +1  429 :white_check_mark: +1  0 :zzz: ±0  0 :x: ±0  474 runs  +1  474 :white_check_mark: +1  0 :zzz: ±0  0 :x: ±0 

Results for commit c9e7dd49. ± Comparison against base commit 8c3d2e61.

This pull request removes 3 and adds 4 tests. Note that renamed tests count towards both. ``` org.incendo.cloud.annotations.feature.MethodSuggestionProviderTest ‑ [5] instance=string list source org.incendo.cloud.annotations.feature.MethodSuggestionProviderTest ‑ [6] instance=source with CommandInput injected org.incendo.cloud.annotations.feature.MethodSuggestionProviderTest ‑ [7] instance=source with injected value ``` ``` org.incendo.cloud.annotations.feature.MethodSuggestionProviderTest ‑ [5] instance=list future source org.incendo.cloud.annotations.feature.MethodSuggestionProviderTest ‑ [6] instance=string list source org.incendo.cloud.annotations.feature.MethodSuggestionProviderTest ‑ [7] instance=source with CommandInput injected org.incendo.cloud.annotations.feature.MethodSuggestionProviderTest ‑ [8] instance=source with injected value ```

:recycle: This comment has been updated with latest results.