This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new c9889bbba4 org.apache.juneau.common.reflect API improvements
c9889bbba4 is described below
commit c9889bbba46398da968611c9c65465ea3bafecab
Author: James Bognar <[email protected]>
AuthorDate: Mon Nov 24 13:05:24 2025 -0500
org.apache.juneau.common.reflect API improvements
---
.../org/apache/juneau/common/annotation/AnnotationObject.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
index ef9301a34e..2419956368 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/annotation/AnnotationObject.java
@@ -23,6 +23,7 @@ import static org.apache.juneau.common.utils.Utils.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
+import java.util.function.*;
import org.apache.juneau.common.utils.*;
@@ -167,7 +168,7 @@ public class AnnotationObject implements Annotation {
//-----------------------------------------------------------------------------------------------------------------
private final Class<? extends Annotation> annotationType;
- private int hashCode = -1;
+ private Supplier<Integer> hashCode = memoize(() ->
AnnotationUtils.hash(this));
/**
* Constructor.
@@ -190,16 +191,12 @@ public class AnnotationObject implements Annotation {
@Override /* Overridden from Object */
public boolean equals(Object o) {
- if (! annotationType.isInstance(o))
- return false;
- return eq(this, (Annotation)o);
+ return o instanceof Annotation o2 &&
annotationType.isInstance(o) && eq(this, o2);
}
@Override /* Overridden from Object */
public int hashCode() {
- if (hashCode == -1)
- hashCode = AnnotationUtils.hash(this);
- return hashCode;
+ return hashCode.get();
}
/**