Skip to content

Conversation

@bentsherman
Copy link
Member

Fix #6152

Functions in the standard library that return an array instead of a list are problematic because arrays don't have all the same functionality of a list. For example, a Path[] can't be accepted by process path inputs which expect a Collection<Path>.

Should be effectively non-breaking for Nextflow users, but let's see if it breaks anything in the runtime...

@bentsherman bentsherman requested a review from jorgee November 19, 2025 05:05
@netlify
Copy link

netlify bot commented Nov 19, 2025

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit b43bdd5
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/691e9b941e80b400085f9f55
😎 Deploy Preview https://deploy-preview-6581--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pditommaso
Copy link
Member

This can introduce breaking changes in third parties pipelines. Not sure the change is worth

@bentsherman
Copy link
Member Author

The problem is that these methods are documented in the Nextflow language as returning a list instead of an array:

list() -> List<String>

Returns the first-level elements (files and directories) of a directory as a list of strings.

listFiles() -> List<Path>

Returns the first-level elements (files and directories) of a directory as a list of Paths.

Because arrays don't exist in the Nextflow type system

It looks like everyone is wrapping listFiles() with an extra call like .toList() or as List<Path> in order to use it like an actual list. So for them it should not be breaking, it will just enable additional functionality

Copy link
Member

@pditommaso pditommaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the point about type system, however the array type has been used to keep aligned with the File version in Groovy SDK, until there isn't a clear boundary between nextflow and groovy and java API this change little.

Secondly and even this kind of changes are extremely annoying for users because may introduce subtle bugs hard to detect, and confuse agents.

If this change is really needed better to deprecated, document and induce and new API

@bentsherman
Copy link
Member Author

the array type has been used to keep aligned with the File version in Groovy SDK

@pditommaso what method are you talking about? I can't find anything in the Groovy or Java SDK that returns a path array

@bentsherman
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use basic groovy operations on process path() input Path listFiles return type not accepted by process path input

4 participants