[GitHub] commons-lang pull request #307: Fix TypeUtils.parameterize to work correctly...

2017-12-20 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] commons-lang pull request #307: Fix TypeUtils.parameterize to work correctly...

2017-11-12 Thread MaridProject
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 mapping = Collections.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 
Date:   2017-11-12T18:49:07Z

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




---