Add Eclipse IDE generated methods for equals and hashCode
diff --git a/api/src/main/java/jakarta/el/MethodReference.java b/api/src/main/java/jakarta/el/MethodReference.java
index 5d4e39a..a246707 100644
--- a/api/src/main/java/jakarta/el/MethodReference.java
+++ b/api/src/main/java/jakarta/el/MethodReference.java
@@ -16,9 +16,13 @@
package jakarta.el;
import java.lang.annotation.Annotation;
+import java.util.Arrays;
/**
* Provides information about the method to which a method expression resolves.
+ *
+ * Two MethodReference instances are considered equal if the reference the same
+ * method on the same base object.
*/
public class MethodReference {
@@ -81,4 +85,52 @@
public Object[] getEvaluatedParameters() {
return evaluatedParameters;
}
+
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(annotations);
+ result = prime * result + ((base == null) ? 0 : base.hashCode());
+ result = prime * result + Arrays.deepHashCode(evaluatedParameters);
+ result = prime * result + ((methodInfo == null) ? 0 : methodInfo.hashCode());
+ return result;
+ }
+
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ MethodReference other = (MethodReference) obj;
+ if (!Arrays.equals(annotations, other.annotations)) {
+ return false;
+ }
+ if (base == null) {
+ if (other.base != null) {
+ return false;
+ }
+ } else if (!base.equals(other.base)) {
+ return false;
+ }
+ if (!Arrays.deepEquals(evaluatedParameters, other.evaluatedParameters)) {
+ return false;
+ }
+ if (methodInfo == null) {
+ if (other.methodInfo != null) {
+ return false;
+ }
+ } else if (!methodInfo.equals(other.methodInfo)) {
+ return false;
+ }
+ return true;
+ }
}