You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When indexing a Kotlin-compiled class that includes the following method:
funfoo(bar:List<List<@Valid String>>) {
}
Jandex fails with the following exception:
java.lang.IllegalArgumentException: Not a parameterized type!
at org.jboss.jandex.Type.asParameterizedType(Type.java:248)
at org.jboss.jandex.Indexer.resolveTypePath(Indexer.java:1256)
at org.jboss.jandex.Indexer.resolveTypePath(Indexer.java:1263)
at org.jboss.jandex.Indexer.resolveTypeAnnotation(Indexer.java:1105)
at org.jboss.jandex.Indexer.resolveTypeAnnotations(Indexer.java:957)
at org.jboss.jandex.Indexer.indexWithSummary(Indexer.java:2363)
at org.jboss.jandex.Indexer.index(Indexer.java:2317)
So the annotation is correctly attributed to the 1st (or 0th if you wish) parameter of the method, but the type annotation path is wrong.
The type annotation path is basically:
take the type of the 0th parameter, it must be a parameterized type, and take the 0th type argument
take the previously obtained type, it must be a parameterized type, and take the 0th type argument
The 2nd step fails -- because the type obtained in step 1 is a wildcard type, not a parameterized type. Remember that the type is effectively List<? extends List<@Valid String>>.
For the Java snippet above, javac emits the annotation like this:
I agree Jandex shouldn't fail like this, but it can't be denied that the Kotlin compiler emits internally inconsistent bytecode. My opinion is that Jandex should just skip this type annotation.
Ladicek
changed the title
Jandex fails when indexing a Kotlin-generated class with type annotations
Jandex fails when indexing a Kotlin-generated class with certain type annotation
Nov 22, 2022
When indexing a Kotlin-compiled class that includes the following method:
Jandex fails with the following exception:
Originally reported at quarkusio/quarkus#29376
The text was updated successfully, but these errors were encountered: