smallrye / jandex

Java Annotation Indexer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jandex-maven-plugin throws IllegalArgumentException: Comparison method violates its general contract

mvilliger opened this issue · comments

I get the following exception when using jandex-maven-plugin 3.0.4 with Java 11.0.17:

java.lang.IllegalArgumentException: Comparison method violates its general contract!
    at java.util.TimSort.mergeHi (TimSort.java:903)
    at java.util.TimSort.mergeAt (TimSort.java:520)
    at java.util.TimSort.mergeForceCollapse (TimSort.java:461)
    at java.util.TimSort.sort (TimSort.java:254)
    at java.util.Arrays.sort (Arrays.java:1515)
    at java.util.ArrayList.sort (ArrayList.java:1750)
    at org.jboss.jandex.Indexer.propagateTypeParameterBounds (Indexer.java:2422)
    at org.jboss.jandex.Indexer.complete (Indexer.java:2402)
    at org.jboss.jandex.maven.JandexGoal.execute (JandexGoal.java:163)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    ...

It seems that this Comparator used in Indexer#propagateTypeParameterBounds does not follow the contract required by java.util.Comparator?

Steps to reproduce:

  1. git clone https://github.com/mvilliger/jandex-maven-plugin-iae.git
  2. cd jandex-maven-plugin-iae
  3. mvn clean verify -e

An additional note: It seems to be a regression as the older plugin org.jboss.jandex:jandex-maven-plugin:1.2.3 works fine on the same code base.

Okay, that's pretty bad. Thanks for reproducer!

It seems to be a regression as the older plugin org.jboss.jandex:jandex-maven-plugin:1.2.3 works fine on the same code base.

Yeah, Jandex 2.x didn't propagate type annotations across nested classes. That code is new in Jandex 3.

Wow, thank you very much for the incredibly fast fix!! 🎉
Do you already know when we could expect a 3.0.5 release to appear on Maven central?

I'll release 3.0.5 later today.

FYI, 3.0.5 is available in Central now.

Thank you very much!
Awesome time to market :)

I can confirm the issue is fixed 🎉👌

Thank you!