[LANG-1218] EqualsBuilder.append(Object,Object) is too big to be

inlined, which prevents whole builder to be scalarized. Closes #138.
This commit is contained in:
ggregory 2016-05-08 09:34:34 -07:00
parent 2b52dedd56
commit bbd1dc3439
2 changed files with 17 additions and 2 deletions

View File

@ -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>

View File

@ -479,7 +479,22 @@ public EqualsBuilder append(final Object lhs, final Object rhs) {
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 @@ else if (lhs instanceof long[]) {
// Not an array of primitives
append((Object[]) lhs, (Object[]) rhs);
}
return this;
}
/**