You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/05/08 16:34:40 UTC
[lang] [LANG-1218] EqualsBuilder.append(Object,
Object) is too big to be inlined,
which prevents whole builder to be scalarized. Closes #138.
Repository: commons-lang
Updated Branches:
refs/heads/master 2b52dedd5 -> bbd1dc343
[LANG-1218] EqualsBuilder.append(Object,Object) is too big to be
inlined, which prevents whole builder to be scalarized. Closes #138.
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/bbd1dc34
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/bbd1dc34
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/bbd1dc34
Branch: refs/heads/master
Commit: bbd1dc343992fde4baaa0309178509dd07eed536
Parents: 2b52ded
Author: ggregory <gg...@apache.org>
Authored: Sun May 8 09:34:34 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sun May 8 09:34:34 2016 -0700
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../commons/lang3/builder/EqualsBuilder.java | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/bbd1dc34/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a4d815b..6e7d230 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-1218" type="update" dev="ggregory" due-to="Ruslan Cheremin">EqualsBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized</action>
<action issue="LANG-1205" type="fix" dev="chas" due-to="pbrose">NumberUtils.createNumber() behaves inconsistently with NumberUtils.isNumber()</action>
<action issue="LANG-1115" type="add" dev="chas" due-to="Jim Lloyd, Joe Ferner">Add support for varargs in ConstructorUtils, MemberUtils, and MethodUtils</action>
<action issue="LANG-1134" type="add" dev="chas" due-to="Alan Smithee">New methods for lang3.Validate</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/bbd1dc34/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
index a47223d..b6c59de 100644
--- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
@@ -479,7 +479,22 @@ public class EqualsBuilder implements Builder<Boolean> {
if (!lhsClass.isArray()) {
// The simple case, not an array, just test the element
isEquals = lhs.equals(rhs);
- } else if (lhs.getClass() != rhs.getClass()) {
+ } else {
+ // factor out array case in order to keep method small enough
+ // to be inlined
+ appendArray(lhs, rhs);
+ }
+ return this;
+ }
+
+ /**
+ * <p>Test if an <code>Object</code> is equal to an array.</p>
+ *
+ * @param lhs the left hand object, an array
+ * @param rhs the right hand object
+ */
+ private void appendArray(final Object lhs, final Object rhs) {
+ if (lhs.getClass() != rhs.getClass()) {
// Here when we compare different dimensions, for example: a boolean[][] to a boolean[]
this.setEquals(false);
}
@@ -505,7 +520,6 @@ public class EqualsBuilder implements Builder<Boolean> {
// Not an array of primitives
append((Object[]) lhs, (Object[]) rhs);
}
- return this;
}
/**