Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3B83B18120 for ; Wed, 29 Apr 2015 17:49:04 +0000 (UTC) Received: (qmail 12090 invoked by uid 500); 29 Apr 2015 17:48:59 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 11851 invoked by uid 500); 29 Apr 2015 17:48:58 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 11621 invoked by uid 99); 29 Apr 2015 17:48:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2015 17:48:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A51D8E0984; Wed, 29 Apr 2015 17:48:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: britter@apache.org To: commits@commons.apache.org Date: Wed, 29 Apr 2015 17:48:58 -0000 Message-Id: <17e46997be904d7d8d5af1d4164c1375@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] [lang] #LAN-1114 fixes bug in TypeUtils.equals(WildcardType, Type) where it was incorrectly returning true when the second argument was not a Wildcard type. Repository: commons-lang Updated Branches: refs/heads/master 6965455f8 -> 640953167 #LAN-1114 fixes bug in TypeUtils.equals(WildcardType, Type) where it was incorrectly returning true when the second argument was not a Wildcard type. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/e2c0ea43 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/e2c0ea43 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/e2c0ea43 Branch: refs/heads/master Commit: e2c0ea4374c02539ad9bc6c4328b74f25eb72405 Parents: 63d8a02 Author: The Datalorax Authored: Tue Apr 28 21:07:21 2015 +0100 Committer: The Datalorax Committed: Tue Apr 28 21:07:21 2015 +0100 ---------------------------------------------------------------------- .../java/org/apache/commons/lang3/reflect/TypeUtils.java | 2 +- .../org/apache/commons/lang3/reflect/TypeUtilsTest.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/e2c0ea43/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java index 1a750e9..91313c6 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java @@ -1626,7 +1626,7 @@ public class TypeUtils { return equals(getImplicitLowerBounds(w), getImplicitLowerBounds(other)) && equals(getImplicitUpperBounds(w), getImplicitUpperBounds(other)); } - return true; + return false; } /** http://git-wip-us.apache.org/repos/asf/commons-lang/blob/e2c0ea43/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java index 60c8b48..56b23a2 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java @@ -97,6 +97,8 @@ public class TypeUtilsTest { public static Comparable longComparable; + public static Comparable wildcardComparable; + public static URI uri; public void dummyMethod(final List list0, final List list1, final List list2, @@ -723,6 +725,15 @@ public class TypeUtilsTest { } @Test + public void testLang1114() throws Exception { + final Type nonWildcardType = getClass().getDeclaredField("wildcardComparable").getGenericType(); + final Type wildcardType = ((ParameterizedType)nonWildcardType).getActualTypeArguments()[0]; + + Assert.assertFalse(TypeUtils.equals(wildcardType, nonWildcardType)); + Assert.assertFalse(TypeUtils.equals(nonWildcardType, wildcardType)); + } + + @Test public void testGenericArrayType() throws Exception { final Type expected = getClass().getField("intWildcardComparable").getGenericType(); final GenericArrayType actual =