From 9d27563a0c45f1f8fe385ece1b8edbea7c0c884a Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Fri, 22 Sep 2023 15:31:40 +0200 Subject: [PATCH 1/2] Upgrade to Jandex 3.1.5 --- bom/application/pom.xml | 2 +- build-parent/pom.xml | 2 +- independent-projects/arc/pom.xml | 2 +- independent-projects/bootstrap/pom.xml | 2 +- independent-projects/junit5-virtual-threads/pom.xml | 4 ++-- independent-projects/qute/pom.xml | 2 +- independent-projects/resteasy-reactive/pom.xml | 2 +- independent-projects/tools/pom.xml | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 8f3d64d175531..5b02ec11fc167 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -20,7 +20,7 @@ 1.0.16 5.0.0 3.0.2 - 3.1.3 + 3.1.5 1.3.2 1 1.1.2 diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 91aebf3fa31d4..462098d3a3462 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -33,7 +33,7 @@ ${version.surefire.plugin} - 3.1.3 + 3.1.5 1.0.0 2.5.10 diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 1fc71b3db0415..079419c1a867d 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -48,7 +48,7 @@ 2.0.1 1.7.0 - 3.1.3 + 3.1.5 3.5.3.Final 2.2.0 1.6.Final diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 1236a615edb48..f55274efa521a 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -40,7 +40,7 @@ 3.11.0 3.2.1 3.1.2 - 3.1.3 + 3.1.5 3.24.2 diff --git a/independent-projects/junit5-virtual-threads/pom.xml b/independent-projects/junit5-virtual-threads/pom.xml index f3cac0d65d5bc..0f5a5618ac3f1 100644 --- a/independent-projects/junit5-virtual-threads/pom.xml +++ b/independent-projects/junit5-virtual-threads/pom.xml @@ -44,7 +44,7 @@ 3.11.0 3.2.1 3.1.2 - 3.1.3 + 3.1.5 2.23.0 1.9.0 @@ -295,4 +295,4 @@ - \ No newline at end of file + diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index 551ebe66ac214..af92986637614 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -43,7 +43,7 @@ 11 5.10.0 3.24.2 - 3.1.3 + 3.1.5 1.7.0 3.5.3.Final 3.11.0 diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 00ce1bdcaf036..69c41f4bbf68b 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -48,7 +48,7 @@ 11 4.0.1 - 3.1.3 + 3.1.5 1.12.12 5.10.0 3.9.3 diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index 00bd02a7bc918..10ed0138fb11c 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -62,7 +62,7 @@ 3.1.2 ${project.version} 25 - 3.1.3 + 3.1.5 2.0.2 4.2.0 From fcbd46d54723aa04a9d3dc70a269ced00e5dc1de Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Mon, 25 Sep 2023 11:43:29 +0200 Subject: [PATCH 2/2] ArC: fix hash code of TypeAndQualifiers The `TypeAndQualifiers` compound is used as a key in hash maps, which means its equality and hash code must be consistent. Unfortunately, the implementation of `equals()` is completely custom, because it needs to ignore `AnnotationInstance.target`, yet the `hashCode()` implementation blindly delegates to `AnnotationInstance`. That used to work, because `AnnotationInstance.hashCode()` ignored the `target` before, but that has never been a stated contract. A completely custom implementation of equality should always be accompanied by a custom implementation of hash code. That's what this commit does. --- .../arc/processor/InjectionPointInfo.java | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java index f98d4bda71cd4..3174b2976989f 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java @@ -388,7 +388,8 @@ public TypeAndQualifiers(Type type, Set qualifiers) { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((qualifiers == null) ? 0 : qualifiers.hashCode()); + // We cannot use AnnotationInstance#hashCode() as it includes the AnnotationTarget + result = prime * result + annotationSetHashCode(qualifiers); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; } @@ -409,8 +410,8 @@ public boolean equals(Object obj) { if (other.qualifiers != null) { return false; } - } else if (!qualifiersAreEqual(qualifiers, other.qualifiers)) { - // We cannot use AnnotationInstance#equals() as it requires the exact same annotationTarget instance + } else if (!annotationSetEquals(qualifiers, other.qualifiers)) { + // We cannot use AnnotationInstance#equals() as it requires the exact same AnnotationTarget instance return false; } if (type == null) { @@ -423,16 +424,16 @@ public boolean equals(Object obj) { return true; } - private boolean qualifiersAreEqual(Set q1, Set q2) { - if (q1 == q2) { + private static boolean annotationSetEquals(Set s1, Set s2) { + if (s1 == s2) { return true; } - if (q1.size() != q2.size()) { + if (s1.size() != s2.size()) { return false; } - for (AnnotationInstance a1 : q1) { - for (AnnotationInstance a2 : q2) { - if (!annotationsAreEqual(a1, a2)) { + for (AnnotationInstance a1 : s1) { + for (AnnotationInstance a2 : s2) { + if (!annotationEquals(a1, a2)) { return false; } } @@ -440,13 +441,27 @@ private boolean qualifiersAreEqual(Set q1, Set s) { + int result = 1; + for (AnnotationInstance a : s) { + result = 31 * result + annotationHashCode(a); + } + return result; + } + + private static int annotationHashCode(AnnotationInstance a) { + int result = a.name().hashCode(); + result = 31 * result + a.values().hashCode(); + return result; + } + } }