This issue has been created
There is 1 comment.
 
 
XWiki Commons / cid:jira-generated-image-avatar-877d8823-394b-4ca4-b0de-6f85fd2e60d9 XCOMMONS-3336 Open

Add support for standard empty collections in ConverterManager

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-ad2316f0-7f61-43b2-913f-ae5b6d3f3d66 Thomas Mortagne created this issue on 20/May/25 15:57
 
Summary: Add support for standard empty collections in ConverterManager
Issue Type: cid:jira-generated-image-avatar-877d8823-394b-4ca4-b0de-6f85fd2e60d9 Improvement
Affects Versions: 17.4.0-rc-1
Assignee: Unassigned
Components: Properties
Created: 20/May/25 15:57
Priority: cid:jira-generated-image-static-major-0e09e21a-8252-4317-8fd0-148e3f5357ca Major
Reporter: Thomas Mortagne
Description:

Right now, something like the following won't work:

converterManager.convert(mylist, Collections.emptyList().getClass()}}

The reason is that the class here is the private Collections.EmptyList, so impossible to use it in the usual Converter component declaration.

But it does not make much sense to not support such common types so we need to find a hack. This is especially important for tools like ConfigurationSource implementation, where it's very natural to do things like

configuration.getProperty("mykey", List.of())
 
 

1 comment

 
cid:jira-generated-image-avatar-ad2316f0-7f61-43b2-913f-ae5b6d3f3d66 Thomas Mortagne on 20/May/25 15:58
 

All I can think of is a listener in charge of registering a bunch converter component entry associated to those types by going through getClass().