[NO ISSUE] Remove deprecated uses of ObjectUtils
- user model changes: no
- storage format changes: no
- interface changes: no
Change-Id: Ia6f67c6370da80f19e6a51b957009816805b6428
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2205
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Contrib: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ExtensionId.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ExtensionId.java
index 1cd0ce7..0e0a67c 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ExtensionId.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/ExtensionId.java
@@ -19,8 +19,7 @@
package org.apache.asterix.common.api;
import java.io.Serializable;
-
-import org.apache.commons.lang3.ObjectUtils;
+import java.util.Objects;
public class ExtensionId implements Serializable {
@@ -35,7 +34,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(getName().hashCode(), version);
+ return Objects.hash(getName().hashCode(), version);
}
@Override
@@ -44,7 +43,7 @@
return true;
} else if (o instanceof ExtensionId) {
ExtensionId oExtensionId = (ExtensionId) o;
- return version == oExtensionId.version && ObjectUtils.equals(name, oExtensionId.getName());
+ return version == oExtensionId.version && Objects.equals(name, oExtensionId.getName());
}
return false;
}
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtension.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtension.java
index 57a3c79..89a44c7 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtension.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixExtension.java
@@ -20,8 +20,8 @@
import java.util.Collections;
import java.util.List;
+import java.util.Objects;
-import org.apache.commons.lang3.ObjectUtils;
import org.apache.hyracks.algebricks.common.utils.Pair;
public class AsterixExtension {
@@ -50,13 +50,13 @@
public boolean equals(Object o) {
if (o instanceof AsterixExtension) {
AsterixExtension other = (AsterixExtension) o;
- return ObjectUtils.equals(className, other.className) && ObjectUtils.equals(args, other.args);
+ return Objects.equals(className, other.className) && Objects.equals(args, other.args);
}
return false;
}
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(className);
+ return Objects.hash(className);
}
}
\ No newline at end of file
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFile.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFile.java
index 2aac497..8fbab3c 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFile.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/ExternalFile.java
@@ -21,9 +21,9 @@
import java.io.Serializable;
import java.util.Date;
+import java.util.Objects;
import org.apache.asterix.common.config.DatasetConfig.ExternalFilePendingOp;
-import org.apache.commons.lang3.ObjectUtils;
public class ExternalFile implements Serializable, Comparable<ExternalFile> {
@@ -120,7 +120,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(dataverseName, datasetName, fileName);
+ return Objects.hash(dataverseName, datasetName, fileName);
}
@Override
@@ -132,8 +132,8 @@
return false;
}
ExternalFile anotherFile = (ExternalFile) obj;
- return fileNumber == anotherFile.fileNumber && ObjectUtils.equals(dataverseName, anotherFile.getDataverseName())
- && ObjectUtils.equals(datasetName, anotherFile.getDatasetName());
+ return fileNumber == anotherFile.fileNumber && Objects.equals(dataverseName, anotherFile.getDataverseName())
+ && Objects.equals(datasetName, anotherFile.getDatasetName());
}
@Override
diff --git a/asterixdb/asterix-lang-common/pom.xml b/asterixdb/asterix-lang-common/pom.xml
index b6c6e7a..0ee5030 100644
--- a/asterixdb/asterix-lang-common/pom.xml
+++ b/asterixdb/asterix-lang-common/pom.xml
@@ -99,10 +99,6 @@
<artifactId>hyracks-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.hyracks</groupId>
<artifactId>hyracks-data-std</artifactId>
</dependency>
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
index ac7cbbf..31c903e 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/GroupbyClause.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
@@ -29,7 +30,6 @@
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
import org.apache.hyracks.algebricks.common.utils.Pair;
public class GroupbyClause implements Clause {
@@ -146,11 +146,12 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(decorPairList, gbyPairList, groupAll, groupFieldList, groupVar,
- hashGroupByHint, withVarMap);
+ return Objects.hash(decorPairList, gbyPairList, groupAll, groupFieldList, groupVar, hashGroupByHint,
+ withVarMap);
}
@Override
+ @SuppressWarnings("squid:S1067") // expressions should not be too complex
public boolean equals(Object object) {
if (this == object) {
return true;
@@ -159,10 +160,9 @@
return false;
}
GroupbyClause target = (GroupbyClause) object;
- boolean equals = ObjectUtils.equals(decorPairList, target.decorPairList)
- && ObjectUtils.equals(gbyPairList, target.gbyPairList) && groupAll == target.groupAll
- && ObjectUtils.equals(groupFieldList, target.groupFieldList);
- return equals && ObjectUtils.equals(groupVar, target.groupVar) && hashGroupByHint == target.hashGroupByHint
- && ObjectUtils.equals(withVarMap, target.withVarMap);
+ return Objects.equals(decorPairList, target.decorPairList) && Objects.equals(gbyPairList, target.gbyPairList)
+ && groupAll == target.groupAll && Objects.equals(groupFieldList, target.groupFieldList)
+ && Objects.equals(groupVar, target.groupVar) && hashGroupByHint == target.hashGroupByHint
+ && Objects.equals(withVarMap, target.withVarMap);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LetClause.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LetClause.java
index 7c813d3..df560ea 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LetClause.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LetClause.java
@@ -18,12 +18,13 @@
*/
package org.apache.asterix.lang.common.clause;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class LetClause implements Clause {
private VariableExpr varExpr;
@@ -67,7 +68,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(bindExpr, varExpr);
+ return Objects.hash(bindExpr, varExpr);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java
index 68220fc..fbfa64e 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/LimitClause.java
@@ -18,11 +18,12 @@
*/
package org.apache.asterix.lang.common.clause;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class LimitClause implements Clause {
private Expression limitExpr;
@@ -69,7 +70,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(limitExpr, offset);
+ return Objects.hash(limitExpr, offset);
}
@Override
@@ -81,6 +82,6 @@
return false;
}
LimitClause target = (LimitClause) object;
- return limitExpr.equals(target.getLimitExpr()) && ObjectUtils.equals(offset, target.getOffset());
+ return limitExpr.equals(target.getLimitExpr()) && Objects.equals(offset, target.getOffset());
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/OrderbyClause.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/OrderbyClause.java
index 0dcbd8e..c1ceaa8 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/OrderbyClause.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/OrderbyClause.java
@@ -19,12 +19,12 @@
package org.apache.asterix.lang.common.clause;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
import org.apache.hyracks.dataflow.common.data.partition.range.IRangeMap;
public class OrderbyClause implements Clause {
@@ -100,7 +100,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(modifierList, numFrames, numTuples, orderbyList);
+ return Objects.hash(modifierList, numFrames, numTuples, orderbyList);
}
@Override
@@ -112,7 +112,7 @@
return false;
}
OrderbyClause target = (OrderbyClause) object;
- return ObjectUtils.equals(modifierList, target.modifierList) && numFrames == target.numFrames
+ return Objects.equals(modifierList, target.modifierList) && numFrames == target.numFrames
&& numTuples == target.numTuples && orderbyList.equals(target.orderbyList);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/UpdateClause.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/UpdateClause.java
index 75f6fbd..4089c07 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/UpdateClause.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/clause/UpdateClause.java
@@ -18,6 +18,8 @@
*/
package org.apache.asterix.lang.common.clause;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
import org.apache.asterix.lang.common.base.Expression;
@@ -25,7 +27,6 @@
import org.apache.asterix.lang.common.statement.InsertStatement;
import org.apache.asterix.lang.common.statement.UpdateStatement;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class UpdateClause implements Clause {
@@ -118,10 +119,11 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(condition, ds, elsebranch, ifbranch, is, target, us, value);
+ return Objects.hash(condition, ds, elsebranch, ifbranch, is, target, us, value);
}
@Override
+ @SuppressWarnings("squid:S1067") // expressions should not be too complex
public boolean equals(Object object) {
if (this == object) {
return false;
@@ -130,11 +132,10 @@
return false;
}
UpdateClause other = (UpdateClause) object;
- boolean equals = ObjectUtils.equals(condition, other.condition) && ObjectUtils.equals(ds, other.ds)
- && ObjectUtils.equals(elsebranch, other.elsebranch) && ObjectUtils.equals(ifbranch, other.ifbranch);
- equals = equals && ObjectUtils.equals(is, other.is) && ObjectUtils.equals(target, other.target)
- && ObjectUtils.equals(us, other.us);
- return equals && ObjectUtils.equals(value, other.value);
+ return Objects.equals(condition, other.condition) && Objects.equals(ds, other.ds)
+ && Objects.equals(elsebranch, other.elsebranch) && Objects.equals(ifbranch, other.ifbranch)
+ && Objects.equals(is, other.is) && Objects.equals(target, other.target) && Objects.equals(us, other.us)
+ && Objects.equals(value, other.value);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java
index ebdaac7..6582b9d 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/CallExpr.java
@@ -19,13 +19,13 @@
package org.apache.asterix.lang.common.expression;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.common.functions.FunctionSignature;
import org.apache.asterix.lang.common.base.AbstractExpression;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class CallExpr extends AbstractExpression {
private FunctionSignature functionSignature;
@@ -69,7 +69,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(exprList, functionSignature);
+ return Objects.hash(exprList, functionSignature);
}
@Override
@@ -81,7 +81,6 @@
return false;
}
CallExpr target = (CallExpr) object;
- return ObjectUtils.equals(exprList, target.exprList)
- && ObjectUtils.equals(functionSignature, target.functionSignature);
+ return Objects.equals(exprList, target.exprList) && Objects.equals(functionSignature, target.functionSignature);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldAccessor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldAccessor.java
index 7009d90..d47a509 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldAccessor.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldAccessor.java
@@ -18,11 +18,12 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class FieldAccessor extends AbstractAccessor {
private Identifier ident;
@@ -57,7 +58,7 @@
@Override
public int hashCode() {
- return 31 * super.hashCode() + ObjectUtils.hashCode(ident);
+ return 31 * super.hashCode() + Objects.hashCode(ident);
}
@Override
@@ -69,6 +70,6 @@
return false;
}
FieldAccessor target = (FieldAccessor) object;
- return super.equals(target) && ObjectUtils.equals(ident, target.ident);
+ return super.equals(target) && Objects.equals(ident, target.ident);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldBinding.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldBinding.java
index afadddd..b9683eb 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldBinding.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/FieldBinding.java
@@ -18,8 +18,9 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
+
import org.apache.asterix.lang.common.base.Expression;
-import org.apache.commons.lang3.ObjectUtils;
public class FieldBinding {
private Expression leftExpr;
@@ -53,7 +54,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(leftExpr, rightExpr);
+ return Objects.hash(leftExpr, rightExpr);
}
@Override
@@ -65,7 +66,7 @@
return false;
}
FieldBinding target = (FieldBinding) object;
- return ObjectUtils.equals(leftExpr, target.leftExpr) && ObjectUtils.equals(rightExpr, target.rightExpr);
+ return Objects.equals(leftExpr, target.leftExpr) && Objects.equals(rightExpr, target.rightExpr);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/GbyVariableExpressionPair.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/GbyVariableExpressionPair.java
index aaa6526..f436c39 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/GbyVariableExpressionPair.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/GbyVariableExpressionPair.java
@@ -18,8 +18,9 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
+
import org.apache.asterix.lang.common.base.Expression;
-import org.apache.commons.lang3.ObjectUtils;
public class GbyVariableExpressionPair {
private VariableExpr var; // can be null
@@ -53,7 +54,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(expr, var);
+ return Objects.hash(expr, var);
}
@Override
@@ -65,7 +66,7 @@
return false;
}
GbyVariableExpressionPair target = (GbyVariableExpressionPair) object;
- return ObjectUtils.equals(expr, target.expr) && ObjectUtils.equals(var, target.var);
+ return Objects.equals(expr, target.expr) && Objects.equals(var, target.var);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java
index c833109..754aad4 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java
@@ -18,11 +18,12 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.AbstractExpression;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class IfExpr extends AbstractExpression {
private Expression condExpr;
@@ -75,7 +76,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(condExpr, elseExpr, thenExpr);
+ return Objects.hash(condExpr, elseExpr, thenExpr);
}
@Override
@@ -87,8 +88,8 @@
return false;
}
IfExpr target = (IfExpr) object;
- return ObjectUtils.equals(condExpr, target.condExpr) && ObjectUtils.equals(elseExpr, target.elseExpr)
- && ObjectUtils.equals(thenExpr, target.thenExpr);
+ return Objects.equals(condExpr, target.condExpr) && Objects.equals(elseExpr, target.elseExpr)
+ && Objects.equals(thenExpr, target.thenExpr);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IndexAccessor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IndexAccessor.java
index 36111a6..102c133 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IndexAccessor.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IndexAccessor.java
@@ -18,10 +18,11 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class IndexAccessor extends AbstractAccessor {
private boolean isAny;
@@ -63,7 +64,7 @@
@Override
public int hashCode() {
- return 31 * super.hashCode() + ObjectUtils.hashCodeMulti(indexExpr, isAny);
+ return 31 * super.hashCode() + Objects.hash(indexExpr, isAny);
}
@Override
@@ -75,7 +76,7 @@
return false;
}
IndexAccessor target = (IndexAccessor) object;
- return super.equals(target) && isAny == target.isAny && ObjectUtils.equals(indexExpr, target.indexExpr);
+ return super.equals(target) && isAny == target.isAny && Objects.equals(indexExpr, target.indexExpr);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
index b35aa91..5cc759c 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
@@ -20,13 +20,13 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.AbstractExpression;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.struct.OperatorType;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class OperatorExpr extends AbstractExpression {
private List<Expression> exprList;
@@ -126,7 +126,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(currentop, exprBroadcastIdx, exprList, opList);
+ return Objects.hash(currentop, exprBroadcastIdx, exprList, opList);
}
@Override
@@ -138,7 +138,7 @@
return false;
}
OperatorExpr target = (OperatorExpr) object;
- return currentop == target.isCurrentop() && ObjectUtils.equals(exprBroadcastIdx, target.exprBroadcastIdx)
- && ObjectUtils.equals(exprList, target.exprList) && ObjectUtils.equals(opList, target.opList);
+ return currentop == target.isCurrentop() && Objects.equals(exprBroadcastIdx, target.exprBroadcastIdx)
+ && Objects.equals(exprList, target.exprList) && Objects.equals(opList, target.opList);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java
index 2a42da4f..a35d975 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java
@@ -19,13 +19,13 @@
package org.apache.asterix.lang.common.expression;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.AbstractExpression;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.struct.QuantifiedPair;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class QuantifiedExpression extends AbstractExpression {
private List<QuantifiedPair> quantifiedList;
@@ -84,7 +84,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(quantifiedList, quantifier, satisfiesExpr);
+ return Objects.hash(quantifiedList, quantifier, satisfiesExpr);
}
@Override
@@ -96,8 +96,7 @@
return false;
}
QuantifiedExpression target = (QuantifiedExpression) object;
- return ObjectUtils.equals(quantifiedList, target.quantifiedList)
- && ObjectUtils.equals(quantifier, target.quantifier)
- && ObjectUtils.equals(satisfiesExpr, target.satisfiesExpr);
+ return Objects.equals(quantifiedList, target.quantifiedList) && Objects.equals(quantifier, target.quantifier)
+ && Objects.equals(satisfiesExpr, target.satisfiesExpr);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordTypeDefinition.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordTypeDefinition.java
index 39fbbc4..4aecd92 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordTypeDefinition.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordTypeDefinition.java
@@ -20,12 +20,12 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.annotations.IRecordFieldDataGen;
import org.apache.asterix.common.annotations.UndeclaredFieldsDataGen;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class RecordTypeDefinition implements TypeExpression {
@@ -102,11 +102,11 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(fieldDataGen, fieldNames, fieldTypes, optionalFields, recordKind,
- undeclaredFieldsDataGen);
+ return Objects.hash(fieldDataGen, fieldNames, fieldTypes, optionalFields, recordKind, undeclaredFieldsDataGen);
}
@Override
+ @SuppressWarnings("squid:S1067") // expressions should not be too complex
public boolean equals(Object object) {
if (this == object) {
return true;
@@ -115,11 +115,10 @@
return false;
}
RecordTypeDefinition target = (RecordTypeDefinition) object;
- boolean equals = fieldDataGen.equals(target.getFieldDataGen()) && fieldNames.equals(target.getFieldNames())
- && fieldTypes.equals(target.getFieldNames()) && optionalFields.equals(target.getOptionableFields());
- equals = equals && ObjectUtils.equals(recordKind, target.getRecordKind())
- && ObjectUtils.equals(undeclaredFieldsDataGen, target.getUndeclaredFieldsDataGen());
- return equals;
+ return fieldDataGen.equals(target.getFieldDataGen()) && fieldNames.equals(target.getFieldNames())
+ && fieldTypes.equals(target.getFieldTypes()) && optionalFields.equals(target.getOptionableFields())
+ && Objects.equals(recordKind, target.getRecordKind())
+ && Objects.equals(undeclaredFieldsDataGen, target.getUndeclaredFieldsDataGen());
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java
index f341601..1421f4f 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java
@@ -18,6 +18,7 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
import java.util.Optional;
import org.apache.asterix.common.exceptions.CompilationException;
@@ -25,7 +26,6 @@
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.struct.UnaryExprType;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class UnaryExpr extends AbstractExpression {
private UnaryExprType unaryExprType;
@@ -73,7 +73,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(expr, unaryExprType);
+ return Objects.hash(expr, unaryExprType);
}
@Override
@@ -85,6 +85,6 @@
return false;
}
UnaryExpr target = (UnaryExpr) object;
- return ObjectUtils.equals(expr, target.expr) && ObjectUtils.equals(unaryExprType, target.unaryExprType);
+ return Objects.equals(expr, target.expr) && Objects.equals(unaryExprType, target.unaryExprType);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnorderedListTypeDefinition.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnorderedListTypeDefinition.java
index 48be7d2..8f4b1b7 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnorderedListTypeDefinition.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnorderedListTypeDefinition.java
@@ -18,9 +18,10 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class UnorderedListTypeDefinition implements TypeExpression {
@@ -46,7 +47,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCode(itemTypeExpression);
+ return Objects.hashCode(itemTypeExpression);
}
@Override
@@ -58,6 +59,6 @@
return false;
}
UnorderedListTypeDefinition target = (UnorderedListTypeDefinition) object;
- return ObjectUtils.equals(itemTypeExpression, target.itemTypeExpression);
+ return Objects.equals(itemTypeExpression, target.itemTypeExpression);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
index e55e40d..17d0d2f 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
@@ -18,11 +18,12 @@
*/
package org.apache.asterix.lang.common.expression;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.AbstractExpression;
import org.apache.asterix.lang.common.struct.VarIdentifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class VariableExpr extends AbstractExpression {
private VarIdentifier var;
@@ -67,7 +68,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCode(var);
+ return Objects.hashCode(var);
}
@Override
@@ -79,7 +80,7 @@
return false;
}
VariableExpr expr = (VariableExpr) obj;
- return ObjectUtils.equals(var, expr.var);
+ return Objects.equals(var, expr.var);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DeleteStatement.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DeleteStatement.java
index 7bf0db2..52be683 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DeleteStatement.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DeleteStatement.java
@@ -18,13 +18,14 @@
*/
package org.apache.asterix.lang.common.statement;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.base.Statement;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class DeleteStatement implements Statement {
@@ -84,10 +85,11 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(condition, datasetName, dataverseName, rewrittenQuery, vars);
+ return Objects.hash(condition, datasetName, dataverseName, rewrittenQuery, vars);
}
@Override
+ @SuppressWarnings("squid:S1067") // expressions should not be too complex
public boolean equals(Object object) {
if (this == object) {
return true;
@@ -96,11 +98,10 @@
return false;
}
DeleteStatement target = (DeleteStatement) object;
- boolean equals =
- ObjectUtils.equals(condition, target.condition) && ObjectUtils.equals(datasetName, target.datasetName)
- && ObjectUtils.equals(dataverseName, target.dataverseName);
- return equals && ObjectUtils.equals(rewrittenQuery, target.rewrittenQuery)
- && ObjectUtils.equals(vars, target.vars);
+ return Objects.equals(condition, target.condition) && Objects.equals(datasetName, target.datasetName)
+ && Objects.equals(dataverseName, target.dataverseName)
+ && Objects.equals(rewrittenQuery, target.rewrittenQuery) && Objects.equals(vars, target.vars)
+ && varCounter == target.varCounter;
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/InsertStatement.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/InsertStatement.java
index cc72e1c..4cc2001 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/InsertStatement.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/InsertStatement.java
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Expression;
@@ -28,7 +29,6 @@
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class InsertStatement implements IReturningStatement {
@@ -120,10 +120,11 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(datasetName, dataverseName, query, varCounter, var, returnExpression);
+ return Objects.hash(datasetName, dataverseName, query, varCounter, var, returnExpression);
}
@Override
+ @SuppressWarnings("squid:S1067") // expressions should not be too complex
public boolean equals(Object object) {
if (this == object) {
return true;
@@ -132,10 +133,9 @@
return false;
}
InsertStatement target = (InsertStatement) object;
- return ObjectUtils.equals(datasetName, target.datasetName)
- && ObjectUtils.equals(dataverseName, target.dataverseName) && ObjectUtils.equals(query, target.query)
- && ObjectUtils.equals(varCounter, target.varCounter) && ObjectUtils.equals(var, target.var)
- && ObjectUtils.equals(returnExpression, target.returnExpression);
+ return Objects.equals(datasetName, target.datasetName) && Objects.equals(dataverseName, target.dataverseName)
+ && Objects.equals(query, target.query) && Objects.equals(returnExpression, target.returnExpression)
+ && varCounter == target.varCounter && Objects.equals(var, target.var);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java
index 7274ae3..66a55dc 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/Query.java
@@ -20,13 +20,13 @@
import java.util.Collections;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.base.IReturningStatement;
import org.apache.asterix.lang.common.base.Statement;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class Query implements IReturningStatement {
private final boolean explain;
@@ -95,7 +95,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(body, topLevel, explain);
+ return Objects.hash(body, topLevel, explain, varCounter);
}
@Override
@@ -107,7 +107,8 @@
return false;
}
Query target = (Query) object;
- return explain == target.explain && ObjectUtils.equals(body, target.body) && topLevel == target.topLevel;
+ return explain == target.explain && Objects.equals(body, target.body) && topLevel == target.topLevel
+ && varCounter == target.varCounter;
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/UpdateStatement.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/UpdateStatement.java
index 2f3be71..8f3dbfc 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/UpdateStatement.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/UpdateStatement.java
@@ -19,6 +19,7 @@
package org.apache.asterix.lang.common.statement;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Expression;
@@ -26,7 +27,6 @@
import org.apache.asterix.lang.common.clause.UpdateClause;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class UpdateStatement implements Statement {
@@ -70,7 +70,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(condition, target, ucs, vars);
+ return Objects.hash(condition, target, ucs, vars);
}
@Override
@@ -82,8 +82,8 @@
return false;
}
UpdateStatement update = (UpdateStatement) object;
- return ObjectUtils.equals(condition, update.condition) && ObjectUtils.equals(target, update.target)
- && ObjectUtils.equals(ucs, update.ucs) && ObjectUtils.equals(vars, update.vars);
+ return Objects.equals(condition, update.condition) && Objects.equals(target, update.target)
+ && Objects.equals(ucs, update.ucs) && Objects.equals(vars, update.vars);
}
@Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/QuantifiedPair.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/QuantifiedPair.java
index ab8a3f3..af5f814 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/QuantifiedPair.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/QuantifiedPair.java
@@ -18,9 +18,10 @@
*/
package org.apache.asterix.lang.common.struct;
+import java.util.Objects;
+
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.expression.VariableExpr;
-import org.apache.commons.lang3.ObjectUtils;
public class QuantifiedPair {
private VariableExpr varExpr;
@@ -53,7 +54,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(expr, varExpr);
+ return Objects.hash(expr, varExpr);
}
@Override
@@ -62,6 +63,6 @@
return false;
}
QuantifiedPair target = (QuantifiedPair) object;
- return ObjectUtils.equals(expr, target.expr) && ObjectUtils.equals(varExpr, target.varExpr);
+ return Objects.equals(expr, target.expr) && Objects.equals(varExpr, target.varExpr);
}
}
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java
index ca165ac..091c82d 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java
@@ -18,7 +18,7 @@
*/
package org.apache.asterix.lang.common.struct;
-import org.apache.commons.lang3.ObjectUtils;
+import java.util.Objects;
public final class VarIdentifier extends Identifier {
private int id = 0;
@@ -28,7 +28,7 @@
super();
}
- public VarIdentifier(VarIdentifier v){
+ public VarIdentifier(VarIdentifier v) {
this(v.getValue(), v.getId(), v.namedValueAccess());
}
@@ -47,7 +47,6 @@
this.namedValueAccess = namedValueAccess;
}
-
public void setId(int id) {
this.id = id;
}
@@ -73,7 +72,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(value);
+ return Objects.hash(value);
}
@Override
@@ -82,7 +81,7 @@
return false;
}
VarIdentifier vid = (VarIdentifier) obj;
- return ObjectUtils.equals(value, vid.value);
+ return Objects.equals(value, vid.value);
}
@Override
diff --git a/asterixdb/asterix-lang-sqlpp/pom.xml b/asterixdb/asterix-lang-sqlpp/pom.xml
index a28d2f5..1ef09d1 100644
--- a/asterixdb/asterix-lang-sqlpp/pom.xml
+++ b/asterixdb/asterix-lang-sqlpp/pom.xml
@@ -143,10 +143,6 @@
<artifactId>algebricks-core</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/AbstractBinaryCorrelateClause.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/AbstractBinaryCorrelateClause.java
index ed5f404..40a5ea5 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/AbstractBinaryCorrelateClause.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/AbstractBinaryCorrelateClause.java
@@ -19,11 +19,12 @@
package org.apache.asterix.lang.sqlpp.clause;
+import java.util.Objects;
+
import org.apache.asterix.lang.common.base.Clause;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.sqlpp.optype.JoinType;
-import org.apache.commons.lang3.ObjectUtils;
public abstract class AbstractBinaryCorrelateClause implements Clause {
@@ -66,7 +67,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(joinType, rightExpr, rightPosVar, rightVar);
+ return Objects.hash(joinType, rightExpr, rightPosVar, rightVar);
}
@Override
@@ -78,8 +79,8 @@
return false;
}
AbstractBinaryCorrelateClause target = (AbstractBinaryCorrelateClause) object;
- return ObjectUtils.equals(joinType, target.joinType) && ObjectUtils.equals(rightExpr, target.rightExpr)
- && ObjectUtils.equals(rightPosVar, target.rightPosVar) && ObjectUtils.equals(rightVar, target.rightVar);
+ return Objects.equals(joinType, target.joinType) && Objects.equals(rightExpr, target.rightExpr)
+ && Objects.equals(rightPosVar, target.rightPosVar) && Objects.equals(rightVar, target.rightVar);
}
}
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/FromTerm.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/FromTerm.java
index e4390d9..6860cfe 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/FromTerm.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/FromTerm.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
@@ -28,7 +29,6 @@
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class FromTerm implements Clause {
private Expression leftExpr;
@@ -91,7 +91,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(correlateClauses, leftExpr, leftVar, posVar);
+ return Objects.hash(correlateClauses, leftExpr, leftVar, posVar);
}
@Override
@@ -103,8 +103,7 @@
return false;
}
FromTerm target = (FromTerm) object;
- return ObjectUtils.equals(correlateClauses, target.correlateClauses)
- && ObjectUtils.equals(leftExpr, target.leftExpr) && ObjectUtils.equals(leftVar, target.leftVar)
- && ObjectUtils.equals(posVar, target.posVar);
+ return Objects.equals(correlateClauses, target.correlateClauses) && Objects.equals(leftExpr, target.leftExpr)
+ && Objects.equals(leftVar, target.leftVar) && Objects.equals(posVar, target.posVar);
}
}
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java
index 28d447a..caf1056 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/Projection.java
@@ -19,12 +19,13 @@
package org.apache.asterix.lang.sqlpp.clause;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class Projection implements Clause {
@@ -85,7 +86,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(expr, exprStar, name, star);
+ return Objects.hash(expr, exprStar, name, star);
}
@Override
@@ -97,7 +98,7 @@
return false;
}
Projection target = (Projection) object;
- return ObjectUtils.equals(expr, target.expr) && ObjectUtils.equals(exprStar, target.exprStar)
- && ObjectUtils.equals(name, target.name) && ObjectUtils.equals(star, target.star);
+ return Objects.equals(expr, target.expr) && Objects.equals(name, target.name) && exprStar == target.exprStar
+ && star == target.star;
}
}
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java
index 155e576..0477b1c 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectBlock.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
@@ -29,7 +30,6 @@
import org.apache.asterix.lang.common.clause.WhereClause;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class SelectBlock implements Clause {
@@ -125,11 +125,12 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(fromClause, groupbyClause, havingClause, letClauses, letClausesAfterGby,
- selectClause, whereClause);
+ return Objects.hash(fromClause, groupbyClause, havingClause, letClauses, letClausesAfterGby, selectClause,
+ whereClause);
}
@Override
+ @SuppressWarnings("squid:S1067") // expressions should not be too complex
public boolean equals(Object object) {
if (this == object) {
return true;
@@ -138,13 +139,10 @@
return false;
}
SelectBlock target = (SelectBlock) object;
- boolean equals = ObjectUtils.equals(fromClause, target.fromClause)
- && ObjectUtils.equals(groupbyClause, target.groupbyClause)
- && ObjectUtils.equals(havingClause, target.havingClause)
- && ObjectUtils.equals(letClauses, target.letClauses);
- return equals && ObjectUtils.equals(letClausesAfterGby, target.letClausesAfterGby)
- && ObjectUtils.equals(selectClause, target.selectClause)
- && ObjectUtils.equals(whereClause, target.whereClause);
+ return Objects.equals(fromClause, target.fromClause) && Objects.equals(groupbyClause, target.groupbyClause)
+ && Objects.equals(havingClause, target.havingClause) && Objects.equals(letClauses, target.letClauses)
+ && Objects.equals(letClausesAfterGby, target.letClausesAfterGby)
+ && Objects.equals(selectClause, target.selectClause) && Objects.equals(whereClause, target.whereClause);
}
@Override
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectClause.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectClause.java
index 0a272f9..e5c3f56 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectClause.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectClause.java
@@ -19,11 +19,12 @@
package org.apache.asterix.lang.sqlpp.clause;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class SelectClause implements Clause {
@@ -75,7 +76,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(distinct, selectElement, selectRegular);
+ return Objects.hash(distinct, selectElement, selectRegular);
}
@Override
@@ -87,7 +88,7 @@
return false;
}
SelectClause target = (SelectClause) object;
- return distinct == target.distinct && ObjectUtils.equals(selectElement, target.selectElement)
- && ObjectUtils.equals(selectRegular, target.selectRegular);
+ return distinct == target.distinct && Objects.equals(selectElement, target.selectElement)
+ && Objects.equals(selectRegular, target.selectRegular);
}
}
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectSetOperation.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectSetOperation.java
index ee622ea..18d9879 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectSetOperation.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/clause/SelectSetOperation.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.Clause;
@@ -28,7 +29,6 @@
import org.apache.asterix.lang.sqlpp.struct.SetOperationInput;
import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class SelectSetOperation implements Clause {
@@ -66,7 +66,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(leftInput, rightInputs);
+ return Objects.hash(leftInput, rightInputs);
}
@Override
@@ -78,7 +78,7 @@
return false;
}
SelectSetOperation target = (SelectSetOperation) object;
- return ObjectUtils.equals(leftInput, target.leftInput) && ObjectUtils.equals(rightInputs, target.rightInputs);
+ return Objects.equals(leftInput, target.leftInput) && Objects.equals(rightInputs, target.rightInputs);
}
@Override
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java
index 7163e3c..10cc8f4 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.AbstractExpression;
@@ -29,7 +30,6 @@
import org.apache.asterix.lang.common.literal.NullLiteral;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class CaseExpression extends AbstractExpression {
@@ -111,7 +111,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(conditionExpr, elseExpr, thenExprs, whenExprs);
+ return Objects.hash(conditionExpr, elseExpr, thenExprs, whenExprs);
}
@Override
@@ -123,7 +123,7 @@
return false;
}
CaseExpression target = (CaseExpression) object;
- return ObjectUtils.equals(conditionExpr, target.conditionExpr) && ObjectUtils.equals(elseExpr, target.elseExpr)
- && ObjectUtils.equals(thenExprs, target.thenExprs) && ObjectUtils.equals(thenExprs, thenExprs);
+ return Objects.equals(conditionExpr, target.conditionExpr) && Objects.equals(elseExpr, target.elseExpr)
+ && Objects.equals(thenExprs, target.thenExprs) && Objects.equals(thenExprs, thenExprs);
}
}
\ No newline at end of file
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java
index 16eab44..62b8734 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.base.AbstractExpression;
@@ -29,7 +30,6 @@
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class SelectExpression extends AbstractExpression {
@@ -98,10 +98,11 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(letList, limitClause, orderbyClause, selectSetOperation, subquery);
+ return Objects.hash(letList, limitClause, orderbyClause, selectSetOperation, subquery);
}
@Override
+ @SuppressWarnings("squid:S1067") // expressions should not be too complex
public boolean equals(Object object) {
if (this == object) {
return true;
@@ -110,11 +111,9 @@
return false;
}
SelectExpression target = (SelectExpression) object;
- boolean equals =
- ObjectUtils.equals(letList, target.letList) && ObjectUtils.equals(limitClause, target.limitClause)
- && ObjectUtils.equals(orderbyClause, target.orderbyClause)
- && ObjectUtils.equals(selectSetOperation, target.selectSetOperation);
- return equals && subquery == target.subquery;
+ return Objects.equals(letList, target.letList) && Objects.equals(limitClause, target.limitClause)
+ && Objects.equals(orderbyClause, target.orderbyClause) && subquery == target.subquery
+ && Objects.equals(selectSetOperation, target.selectSetOperation);
}
@Override
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationInput.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationInput.java
index 0c4b65b..a369010 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationInput.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationInput.java
@@ -18,12 +18,13 @@
*/
package org.apache.asterix.lang.sqlpp.struct;
+import java.util.Objects;
+
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-import org.apache.commons.lang3.ObjectUtils;
public class SetOperationInput {
@@ -61,7 +62,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(selectBlock, subquery);
+ return Objects.hash(selectBlock, subquery);
}
@Override
@@ -73,7 +74,7 @@
return false;
}
SetOperationInput target = (SetOperationInput) object;
- return ObjectUtils.equals(selectBlock, target.selectBlock) && ObjectUtils.equals(subquery, target.subquery);
+ return Objects.equals(selectBlock, target.selectBlock) && Objects.equals(subquery, target.subquery);
}
@Override
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationRight.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationRight.java
index ade4119..02a1eb1 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationRight.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/struct/SetOperationRight.java
@@ -18,8 +18,9 @@
*/
package org.apache.asterix.lang.sqlpp.struct;
+import java.util.Objects;
+
import org.apache.asterix.lang.sqlpp.optype.SetOpType;
-import org.apache.commons.lang3.ObjectUtils;
public class SetOperationRight {
@@ -47,7 +48,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(opType, setOperationRightInput, setSemantics);
+ return Objects.hash(opType, setOperationRightInput, setSemantics);
}
@Override
@@ -59,8 +60,8 @@
return false;
}
SetOperationRight target = (SetOperationRight) object;
- return ObjectUtils.equals(opType, target.opType)
- && ObjectUtils.equals(setOperationRightInput, target.setOperationRightInput)
+ return Objects.equals(opType, target.opType)
+ && Objects.equals(setOperationRightInput, target.setOperationRightInput)
&& setSemantics == target.setSemantics;
}
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDatasetId.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDatasetId.java
index 4074cdc..d3e8bcf 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDatasetId.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/ExtensionMetadataDatasetId.java
@@ -19,9 +19,9 @@
package org.apache.asterix.metadata.api;
import java.io.Serializable;
+import java.util.Objects;
import org.apache.asterix.common.api.ExtensionId;
-import org.apache.commons.lang3.ObjectUtils;
public class ExtensionMetadataDatasetId implements Serializable {
@@ -49,14 +49,14 @@
}
if (o instanceof ExtensionMetadataDatasetId) {
ExtensionMetadataDatasetId otherId = (ExtensionMetadataDatasetId) o;
- return ObjectUtils.equals(extensionId, otherId.getExtensionId())
- && ObjectUtils.equals(datasetName, otherId.getDatasetName());
+ return Objects.equals(extensionId, otherId.getExtensionId())
+ && Objects.equals(datasetName, otherId.getDatasetName());
}
return false;
}
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(datasetName, extensionId);
+ return Objects.hash(datasetName, extensionId);
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java
index 1435ca7..25e3255 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java
@@ -21,8 +21,8 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
-import org.apache.commons.lang3.ObjectUtils;
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksException;
@@ -102,8 +102,7 @@
@Override
public int hashCode() {
- return ObjectUtils.hashCodeMulti(aggregatedMemoryByteSize, aggregatedCores, nodeMemoryMap,
- nodeCoreMap);
+ return Objects.hash(aggregatedMemoryByteSize, aggregatedCores, nodeMemoryMap, nodeCoreMap);
}
@Override
@@ -113,9 +112,8 @@
}
ClusterCapacity capacity = (ClusterCapacity) o;
return aggregatedMemoryByteSize == capacity.aggregatedMemoryByteSize
- && aggregatedCores == capacity.aggregatedCores
- && ObjectUtils.equals(nodeMemoryMap, capacity.nodeMemoryMap)
- && ObjectUtils.equals(nodeCoreMap, capacity.nodeCoreMap);
+ && aggregatedCores == capacity.aggregatedCores && Objects.equals(nodeMemoryMap, capacity.nodeMemoryMap)
+ && Objects.equals(nodeCoreMap, capacity.nodeCoreMap);
}
@Override