commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1114) TypeUtils.ParameterizedType#equals doesn't work with wildcard types
Date Sun, 26 Apr 2015 10:40:38 GMT

    [ https://issues.apache.org/jira/browse/LANG-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14512981#comment-14512981
] 

Benedikt Ritter commented on LANG-1114:
---------------------------------------

Hello [~BigAndy],

we usually don't assign special permissions to contirbutors. It's just to much managment overhead
for us. Usually the committer who reviews the patch assigns the issue to himself so that everybody
can see who is working on an issue.

We're currently in the middle of a SVN -> git migration. I'll apply your patch after that
has finished.

Thank you!

> TypeUtils.ParameterizedType#equals doesn't work with wildcard types
> -------------------------------------------------------------------
>
>                 Key: LANG-1114
>                 URL: https://issues.apache.org/jira/browse/LANG-1114
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.reflect.*
>    Affects Versions: 3.3.2, 3.4
>            Reporter: andrew coates
>             Fix For: Review Patch
>
>
> There is a bug in TypeUtils.equals(WilcardType, Type).  It returns true if the other
type is not a WildcardType, it should return false.  See TypeUtils@1629 for v3.3.2 and TypeUtils@791
for v3.4
> Bug can be seen with the following test:
> {code}
> @Test
>     public void shouldHandleEqualityOfParameterizedTypesWithWildcards() throws Exception
{
>         // Given:
>         class SomeType {
>             Collection<?> field;
>         }
>         final ParameterizedType wildcardCollectionType = (ParameterizedType) SomeType.class.getDeclaredField("field").getGenericType();
>         final WildcardType wildcard = (WildcardType) wildcardCollectionType.getActualTypeArguments()[0];
>         final ParameterizedType ptWithWildcard = TypeUtils.parameterize(Collection.class,
wildcard);
>         final ParameterizedType otherPt = TypeUtils.parameterize(Collection.class, String.class);
>         // Then:
>         assertThat(otherPt, is(not(equalTo(ptWithWildcard))));  // Passes
>         assertThat(ptWithWildcard, is(not(equalTo(otherPt))));  // Fails
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message