From 52f39f8ba0b3a4c455aba3c1ff6d958908603f62 Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Wed, 24 Aug 2022 15:48:04 +0200 Subject: [PATCH] HHH-15466 Compatibility with Jandex 3.0.0 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. --- .../boot/archive/scan/spi/ClassFileArchiveEntryHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java index 8679accff6c2..a4866f1a3ce0 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java @@ -61,8 +61,9 @@ public void handleEntry(ArchiveEntry entry, ArchiveContext context) { private ClassDescriptor toClassDescriptor(ArchiveEntry entry) { try (InputStream inputStream = entry.getStreamAccess().accessInputStream()) { Indexer indexer = new Indexer(); - ClassInfo classInfo = indexer.index( inputStream ); + indexer.index( inputStream ); Index index = indexer.complete(); + ClassInfo classInfo = index.getKnownClasses().iterator().next(); return toClassDescriptor( classInfo, index, entry ); } catch (IOException e) {