[ https://issues.apache.org/jira/browse/VELOCITY-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653755#comment-16653755 ]
Claude Brisson commented on VELOCITY-892: ----------------------------------------- The VELOCITY-892 branch is ready to be tested (and it wasn't that easy). *But*. At some point, to register your custom converter, you'll have to call {{addConverter(Type, Class, Converter)}} and how you will specify List<String> for the Type parameter is unclear. For instance, you can do {{TypeUtils.parameterize(List.class, String.class)}} from commons-lang3, or use reflection methods on some custom object. And inside the conversion handling of Velocity, at some point, I have to *compare* two instances of Type. And I'm not meaning a comparison using {{equals()}}, which would work, but since I have to *index* the types in a Map, I need to rely on an {{hashCode()}} equality. And for instance the hash code returned by the commons-lang3 ParameterizedType has nothing to do with Sun hash codes for internal ParameterizedType implementations. Hence, I have to rely on the {{Type.getTypeName()}} method to index types on their names, which doesn't exist in Java 7. So merging this branch would require to raise the javac language target to 1.8. > Method arguments conversions should be based on Type instead of Class > --------------------------------------------------------------------- > > Key: VELOCITY-892 > URL: https://issues.apache.org/jira/browse/VELOCITY-892 > Project: Velocity > Issue Type: Improvement > Components: Engine > Affects Versions: 2.0 > Reporter: Thomas Mortagne > Priority: Major > Fix For: 2.0 > > > I was happy to see that method arguments conversion has been added to 2.0 so > that I can remove the uberspector we have on XWiki side but unfortunately > ConversionHandler is limited to classes which is way too restrictive for us > (for example if the parameter type is List<String> it won't do the same thing > than if the type is List<Integer>). > Our uberspector can be found on > https://github.com/xwiki/xwiki-commons/blob/master/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/MethodArgumentsUberspector.java > to see what we do exactly. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org