You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2015/04/29 19:48:58 UTC

[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 <da...@gmail.com>
Authored: Tue Apr 28 21:07:21 2015 +0100
Committer: The Datalorax <da...@gmail.com>
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<B> {
 
     public static Comparable<Long> longComparable;
 
+    public static Comparable<?> wildcardComparable;
+
     public static URI uri;
 
     public void dummyMethod(final List list0, final List<Object> list1, final List<?> list2,
@@ -723,6 +725,15 @@ public class TypeUtilsTest<B> {
     }
 
     @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 =


[3/3] [lang] Merge branch 'bug/LANG-1114-TypeUtils.Wildcard.equals.bug'

Posted by br...@apache.org.
Merge branch 'bug/LANG-1114-TypeUtils.Wildcard.equals.bug'

LANG-1114: TypeUtils.ParameterizedType#equals doesn't work with wildcard types.
This closes #73 from github. Thanks to Andy Coates.


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/64095316
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/64095316
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/64095316

Branch: refs/heads/master
Commit: 640953167adf3580a2c21077d78e7e7ce84ead03
Parents: 6965455 6271c50
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed Apr 29 19:47:09 2015 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed Apr 29 19:47:09 2015 +0200

----------------------------------------------------------------------
 src/changes/changes.xml                                  |  1 +
 .../java/org/apache/commons/lang3/reflect/TypeUtils.java |  2 +-
 .../org/apache/commons/lang3/reflect/TypeUtilsTest.java  | 11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/64095316/src/changes/changes.xml
----------------------------------------------------------------------
diff --cc src/changes/changes.xml
index 785a3b2,1a59e46..27a7f5c
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@@ -22,9 -22,7 +22,10 @@@
    <body>
  
    <release version="3.5" date="tba" description="tba">
+     <action issue="LANG-1114" type="fix" dev="britter" due-to="Andy Coates">TypeUtils.ParameterizedType#equals doesn't work with wildcard types</action>
 +    <action issue="LANG-1119" type="add" dev="britter" due-to="Loic Guibert">Add rotate(string, int) method to StringUtils</action>
 +    <action issue="LANG-1118" type="fix" dev="britter" due-to="Loic Guibert">StringUtils.repeat('z', -1) throws NegativeArraySizeException</action>
 +    <action issue="LANG-1099" type="add" dev="britter" due-to="Adrian Ber">Add swap and shift operations for arrays to ArrayUtils</action>
      <action issue="LANG-979" type="update" dev="britter" due-to="Bruno P. Kinoshita">TypeUtils.parameterizeWithOwner - wrong format descriptor for "invalid number of type parameters".</action>
      <action issue="LANG-1112" type="update" dev="britter">MultilineRecursiveToStringStyle largely unusable due to being package-private.</action>
      <action issue="LANG-1058" type="update" dev="djones" due-to="Leo Wang">StringUtils.uncapitalize performance improvement</action>


[2/3] [lang] Add LANG-1114 to changes.xml

Posted by br...@apache.org.
Add LANG-1114 to changes.xml


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6271c501
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6271c501
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6271c501

Branch: refs/heads/master
Commit: 6271c5015feecc22b9197ef07170fa15f311aad1
Parents: e2c0ea4
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed Apr 29 19:45:35 2015 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed Apr 29 19:45:35 2015 +0200

----------------------------------------------------------------------
 src/changes/changes.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6271c501/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3e25e06..1a59e46 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,6 +22,7 @@
   <body>
 
   <release version="3.5" date="tba" description="tba">
+    <action issue="LANG-1114" type="fix" dev="britter" due-to="Andy Coates">TypeUtils.ParameterizedType#equals doesn't work with wildcard types</action>
     <action issue="LANG-979" type="update" dev="britter" due-to="Bruno P. Kinoshita">TypeUtils.parameterizeWithOwner - wrong format descriptor for "invalid number of type parameters".</action>
     <action issue="LANG-1112" type="update" dev="britter">MultilineRecursiveToStringStyle largely unusable due to being package-private.</action>
     <action issue="LANG-1058" type="update" dev="djones" due-to="Leo Wang">StringUtils.uncapitalize performance improvement</action>