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

HHH-15466 Compatibility with Jandex 3.0.0 #5241

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Aug 26, 2022

The only change in Jandex 3.0.0 relevant to Hibernate ORM is that
Indexer.index() used to return ClassInfo, but now returns void.
This is a breaking change, but Jandex 3.0.0 has a synthetic bridge
method with the old signature for binary compatibility -- except
it always return null. Therefore, with this commit, Hibernate ORM
simply ignores the return value completely, which makes it compatible
with Jandex 3.0.0 at runtime, even though it is still compiled against
Jandex 2.4. The code is also source-compatible with Jandex 3.0.0 if
that is ever needed.

The only change in Jandex 3.0.0 relevant to Hibernate ORM is that
`Indexer.index()` used to return `ClassInfo`, but now returns `void`.
This is a breaking change, but Jandex 3.0.0 has a synthetic bridge
method with the old signature for binary compatibility -- except
it always return `null`. Therefore, with this commit, Hibernate ORM
simply ignores the return value completely, which makes it compatible
with Jandex 3.0.0 at runtime, even though it is still compiled against
Jandex 2.4. The code is also source-compatible with Jandex 3.0.0 if
that is ever needed.
@Sanne
Copy link
Member

Sanne commented Aug 30, 2022

Jandex 3.0.0 has a synthetic bridge method with the old signature for binary compatibility -- except it always return null.

Just curious, why would you add the method bridge if it's not actually useful towards achieving backwards compatibility?

@Ladicek
Copy link
Contributor Author

Ladicek commented Aug 30, 2022

It achieves binary compatibility, and that allows achieving backwardforward compatibility in a straightforward manner (this PR). Without that, it would be impossible e.g. for Hibernate to be compatible with both Jandex 2.x and 3.0 at the same time.

There's actually a lot of callers of Indexer.index() out there that outright ignore the return value -- those are compatible immediately.

@Sanne
Copy link
Member

Sanne commented Aug 30, 2022

ah, ok right that makes sense. Thanks!

@Sanne Sanne merged commit 52f39f8 into hibernate:5.6 Aug 30, 2022
@Ladicek Ladicek deleted the jandex3-compat-5.6 branch August 30, 2022 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants