smallrye / jandex

Java Annotation Indexer
Apache License 2.0
398 stars 94 forks source link

org.jboss.jandex.UnsupportedVersion: Version: 11 #301

Closed kolotyluk closed 1 year ago

kolotyluk commented 1 year ago

I did clean up all my build.gradle files and manage to eliminate the previous java.lang.ClassCastException... many thanks for the great support I received, but it took me a while to wrap my mind around it properly.

Now, I am getting

                    Caused by:
                    org.jboss.jandex.UnsupportedVersion: Version: 11
                        at app//org.jboss.jandex.IndexReader.initReader(IndexReader.java:87)
                        at app//org.jboss.jandex.IndexReader.readVersion(IndexReader.java:137)
                        at app//org.jboss.jandex.IndexReader.read(IndexReader.java:73)
                        at app//io.helidon.microprofile.openapi.OpenApiCdiExtension.existingIndexFileReader(OpenApiCdiExtension.java:166)
                        ... 86 more

tests.txt

I am a total Jandex newbie, just a guy trying to clean up our monorepo (aka Big Ball Of Mud) of Gradle projects by upgrading from Java 8 to Java 11.

Is this exception referring to Java Version 11, or something else that is Version 11?

ljnelson commented 1 year ago

From Jandex's [relevant javadocs](https://javadoc.io/static/io.smallrye/jandex/3.0.5/org/jboss/jandex/IndexReader.html#read()):

Throws: UnsupportedVersion - if the index data is tagged with a version not known to this reader

So you wrote an index with, probably, given your other support question in this project's bug system and your project's issues with versioning, Jandex 3.x, and then tried to read it with Jandex 2.x.

(This is not an issue with Jandex so probably you want to move your support questions to a better venue such as StackOverflow or something similar.)

Ladicek commented 1 year ago

Version: 11 is indeed a version of the Jandex index. Specifically, 11 means the index was produced by Jandex 3. Considering your other issue, you probably used the Jandex Gradle plugin version 1.x to create a Jandex index of your application -- you should move back to the Jandex Gradle plugin 0.x, which is based on Jandex 2.x (note that Jandex 2.4 produces newer index version than Jandex 2.3, so you may have to configure a specific Jandex version so that the produced index is compatible with the Jandex version enforced by the platform you use).