You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Andraschko (Jira)" <de...@myfaces.apache.org> on 2019/12/03 16:35:00 UTC

[jira] [Resolved] (MYFACES-4311) Custom Converters Do Not Support Generics

     [ https://issues.apache.org/jira/browse/MYFACES-4311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Andraschko resolved MYFACES-4311.
----------------------------------------
    Resolution: Fixed

> Custom Converters Do Not Support Generics
> -----------------------------------------
>
>                 Key: MYFACES-4311
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4311
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-372
>    Affects Versions: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5
>            Reporter: Volodymyr Siedlecki
>            Priority: Minor
>             Fix For: 3.0.0-SNAPSHOT, 2.3.7
>
>         Attachments: ConverterTestApp.war, MYFACES-4311.patch, updated_MYFACES-4311.patch
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Hello,
>  
> A user posted an issue with the Converter's here:
> [https://stackoverflow.com/questions/58825333/facesconverter-is-null-jsf-2-3-cdi-2-0]
>  
> I investigated the issue, and it is caused by the beanManger#getBeans inside the /org/apache/myfaces/cdi/util/CDIUtils.java file.  The getBeans returns an empty set instead of the converter bean. It searches by class, but it should also check by type.   Since it's an problem with MyFaces code, I thought I'd open an issue here. 
>  
> I've provided a patch (overloading the CDIUtil.java methods to accept a type) and sample app (borrowed from StackOverflow). 
>  
> I only modified the code to search by type (1) when using getBeans. Type is obtained from creating a TypeLiteral (2). 
>  
> Since Validators don't check by type as Converters, I can make another fix if you don't have any issues with this patch.
> Please let me know if you have questions or suggestions for the code.
>  
> 1) https://javaee.github.io/javaee-spec/javadocs/javax/enterprise/inject/spi/BeanManager.html#getBeans-java.lang.reflect.Type-java.lang.annotation.Annotation...-
> 2) https://javaee.github.io/javaee-spec/javadocs/javax/enterprise/util/TypeLiteral.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)