scijava-common
scijava-common copied to clipboard
Skip FileListPreprocessor for autofill=false parameters
This pull request is a work in progress.
This pull request changes the API of ModuleService and DefaultModuleService to include an optional parameter boolean acrossTypes that allows checking for solitary unresolved parameters within all inputs/outputs independent of their type, while maintaining the backwards-compatible method signatures.
This allows to replace some duplicated logic in helper methods of FilePreprocessor and FileListPreprocessor by a call to moduleService.getSingleInput(), which makes them respect an autoFill=false parameter annotation and avoid calling uiService.chooseFile/chooseFiles for those parameters.
The intended behavior is verified by two new tests that, before this PR, were failing on their last assertion.
NB: The tests added here call uiService.setHeadless(false) in order to set their custom default UI.
Sorry it's taken me so long to look at this. I now have a dedicated PR review day per week, and this one is on my shortlist right now to review, but I'm trying to apply the 80/20 rule to do the easiest ones first. My hangup on this one is the addition of the acrossTypes parameter. I know it's optional, and does not break backwards compatibility, but it does complexify the API, so I'm going to have a think on whether we truly need it for this new feature. Maybe not this week, maybe not next week, but soon, and for the rest of our lives. 🏠🇪🇸