Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Jandex 3.1.5 #36105

Merged
merged 2 commits into from
Oct 5, 2023
Merged

Upgrade to Jandex 3.1.5 #36105

merged 2 commits into from
Oct 5, 2023

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Sep 22, 2023

@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform labels Sep 22, 2023
@Ladicek
Copy link
Contributor Author

Ladicek commented Sep 22, 2023

Hmm, tests failed in my fork (and likely also here) in quarkus-junit5-component, which is weird. I'll investigate on Monday. Just FYI.

@quarkus-bot

This comment has been minimized.

@Ladicek
Copy link
Contributor Author

Ladicek commented Sep 25, 2023

Added one commit that fixes ArC's TypeAndQualifiers.hashCode(), CC @mkouba

The TypeAndQualifiers.equals() method is completely custom (because AnnotationInstance.equals() takes into account the target), but the TypeAndQualifiers.hashCode() method blindly delegates to AnnotationInstance (because AnnotationInstance.hashCode() used to ignore the target). That is wrong; AnnotationInstance.equals() and hashCode() must always be consistent, but there has never been a stated contract that the AnnotationInstance.hashCode() will stay consistent with a custom implementation of equality that ignores the target. If someone has custom AnnotationInstance equality, they should have a matching hash code (and the two must be consistent, of course).

@Sanne
Copy link
Member

Sanne commented Sep 25, 2023

Was reading the release blog - there's one thing puzzling me: wouldn't the "target" always be the same for a given annotation? I assume it's referring to @java.lang.annotation.Target , so inherently bound to the identity of the annotation?

I would have thought that in this case skipping the target would have been a valid optimisation; wondering what I'm missing.

@Ladicek
Copy link
Contributor Author

Ladicek commented Sep 25, 2023

No, the AnnotationInstance.target is the AnnotationTarget of the annotation, or the thing that the annotation is present on. Class, method, field, type usage, things like that.

@Sanne
Copy link
Member

Sanne commented Sep 25, 2023

Ah, the actual runtime instance! Thanks, that explains my confusion.
Great work :)

if (!annotationsAreEqual(a1, a2)) {
for (AnnotationInstance a1 : s1) {
for (AnnotationInstance a2 : s2) {
if (!annotationEquals(a1, a2)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why don't we use AnnotationInstance.equivalentTo(AnnotationInstance) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because AnnotationInstance doesn't have a corresponding hash code function (yet -- see smallrye/jandex#333). Once AnnotationInstance has both equivalence and equivalence hash code, we remove both annotationEquals and annotationHashCode. Until then, I think it's better to keep both equals and hashCode completely self-sufficient.

In other words, if I switched to AnnotationInstance.equivalentTo(), I would be creating another problem of the same kind that I'm fixing here. Potential problem, that is. The annotationHashCode() implemented in this commit is consistent with AnnotationInstance.equivalentTo(), but there's no stated contract saying that. It would be another dependency on an implementation detail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the contract of AnnotationInstance#equivalentTo() is pretty clear so I don't see a dependency on an implementation detail. But let's keep it independent if you think it's better...

@mkouba
Copy link
Contributor

mkouba commented Sep 25, 2023

Added one commit that fixes ArC's TypeAndQualifiers.hashCode(), CC @mkouba

The TypeAndQualifiers.equals() method is completely custom (because AnnotationInstance.equals() takes into account the target), but the TypeAndQualifiers.hashCode() method blindly delegates to AnnotationInstance (because AnnotationInstance.hashCode() used to ignore the target). That is wrong; AnnotationInstance.equals() and hashCode() must always be consistent, but there has never been a stated contract that the AnnotationInstance.hashCode() will stay consistent with a custom implementation of equality that ignores the target. If someone has custom AnnotationInstance equality, they should have a matching hash code (and the two must be consistent, of course).

Makes sense but I wonder if ArC is the only one who relied on this implementation detail of AnnotationInstance#hashCode() 🤔

@Ladicek
Copy link
Contributor Author

Ladicek commented Sep 25, 2023

That's a good question. Let's see if more tests fail :-)

@mkouba mkouba added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Sep 25, 2023
@quarkus-bot

This comment has been minimized.

@Ladicek
Copy link
Contributor Author

Ladicek commented Sep 26, 2023

The number of failures looks creepy, but I can't reproduce any of them locally and the failures look highly unrelated. Especially the failing Oracle DB tests show errors on the database side ("table or view does not exist", "sequence does not exist", "object SYSTEM.MYPROC is invalid"). Many other PRs fail with the same errors, see e.g. #36131, which suggests this is an infrastructure failure.

@quarkus-bot

This comment has been minimized.

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.
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 3, 2023

Failing Jobs - Building fcbd46d

Status Name Step Failures Logs Raw logs Build scan
✔️ JVM Tests - JDK 11
✔️ JVM Tests - JDK 17
JVM Tests - JDK 17 Windows Build Failures Logs Raw logs
✔️ JVM Tests - JDK 20
✔️ Maven Tests - JDK 11
Maven Tests - JDK 11 Windows Build Failures Logs Raw logs
Native Tests - Virtual Thread - Main Build ⚠️ Check → Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ JVM Tests - JDK 17 Windows #

- Failing: independent-projects/tools/analytics-common 
! Skipped: devtools/cli devtools/gradle/gradle-application-plugin devtools/maven and 219 more

📦 independent-projects/tools/analytics-common

io.quarkus.analytics.AnalyticsServiceTest.sendAnalyticsTest line 160 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: 
Assertion condition defined as a io.quarkus.analytics.AnalyticsServiceTest Expected at least one request matching: {
  "url" : "/v1/track",

io.quarkus.analytics.rest.RestClientFailTest.postIdentityServerTTLExceeded line 87 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: 
Assertion condition defined as a io.quarkus.analytics.rest.RestClientFailTest Expected at least one request matching: {
  "url" : "/v1/identify",

io.quarkus.analytics.rest.RestClientTest.postIdentity line 102 - More details - Source on GitHub

java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)

⚙️ Maven Tests - JDK 11 Windows #

📦 integration-tests/maven

io.quarkus.maven.it.JarRunnerIT.testPlatformPropertiesOverridenInApplicationProperties line 135 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.maven.it.JarRunnerIT that uses io.quarkus.maven.it.verifier.MavenProcessInvocationResult was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

io.quarkus.maven.it.UberJarQuarkusIntegrationTestIT.testUberJar line 13 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.maven.it.QuarkusITBase that uses io.quarkus.maven.it.verifier.MavenProcessInvocationResult was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

io.quarkus.maven.it.JarRunnerIT.testPlatformPropertiesOverridenInApplicationProperties line 135 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.maven.it.JarRunnerIT that uses io.quarkus.maven.it.verifier.MavenProcessInvocationResult was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

io.quarkus.maven.it.UberJarQuarkusIntegrationTestIT.testUberJar line 13 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.maven.it.QuarkusITBase that uses io.quarkus.maven.it.verifier.MavenProcessInvocationResult was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

@gsmet gsmet merged commit eddc83e into quarkusio:main Oct 5, 2023
@quarkus-bot quarkus-bot bot added this to the 3.5 - main milestone Oct 5, 2023
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Oct 5, 2023
@Ladicek Ladicek deleted the jandex-3.1.5 branch October 5, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants