kwin commented on a change in pull request #9:
URL:
https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/pull/9#discussion_r678372186
##########
File path:
src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java
##########
@@ -308,12 +306,7 @@ public static String toString(Object object) {
Iterable<Object> iterable = (Iterable<Object>) object;
return fromIterator(iterable.iterator());
}
- if (object instanceof String || object instanceof Number) {
- Collection<Object> list = new ArrayList<>();
- list.add(object);
- return list;
- }
- return Collections.emptyList();
+ return Collections.singletonList(object);
Review comment:
Modifying the other collections to return immutable lists consistently
requires quite some updates in the test (which currently compare with equals
against a mutable list), therefore I would like to separate this from this
extension. Changing the single element list to be immutable didn't require any
test changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]