GitHub user MaridProject opened a pull request:

    https://github.com/apache/commons-lang/pull/307

    Fix TypeUtils.parameterize to work correctly with narrower-typed array

    Currently the following code:
    ```
    final TypeVariable<?>[] variables = ArrayList.class.getTypeParameters();
    final ParameterizedType parameterizedType = 
TypeUtils.parameterize(ArrayList.class, variables);
    final Map<TypeVariable<?>, Type> mapping = Collections.<TypeVariable<?>, 
Type>singletonMap(variables[0], String.class);
    final Type unrolled = TypeUtils.unrollVariables(mapping, 
parameterizedType); // exception !
    assertEquals(TypeUtils.parameterize(ArrayList.class, String.class), 
unrolled);
    ```
    throws an exception.
    
    So, I added a test and fixed the ParameterizedTypeImpl class.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MaridProject/commons-lang master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/307.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #307
    
----
commit 564f302d142251bd1f60ce4178a2cd994b39dcf1
Author: Dmitry Ovchinnikov <d.ovchinni...@gmail.com>
Date:   2017-11-12T18:49:07Z

    Fix TypeUtils.parameterize to work correctly with narrower-typed varargs 
array

----


---

Reply via email to