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

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

Closed
mvilliger opened this issue Dec 2, 2022 · 8 comments · Fixed by #290
Assignees
Milestone

Comments

@mvilliger
Copy link

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
@mvilliger
Copy link
Author

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.

@Ladicek
Copy link
Contributor

Ladicek commented Dec 2, 2022

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.

@Ladicek Ladicek self-assigned this Dec 2, 2022
mvilliger added a commit to eclipse-scout/scout.docs that referenced this issue Dec 2, 2022
@Ladicek Ladicek added this to the 3.0.5 milestone Dec 2, 2022
@mvilliger
Copy link
Author

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?

@Ladicek
Copy link
Contributor

Ladicek commented Dec 2, 2022

I'll release 3.0.5 later today.

@Ladicek
Copy link
Contributor

Ladicek commented Dec 2, 2022

FYI, 3.0.5 is available in Central now.

@mvilliger
Copy link
Author

mvilliger commented Dec 2, 2022

Thank you very much!
Awesome time to market :)

mvilliger added a commit to eclipse-scout/scout.maven-master that referenced this issue Dec 2, 2022
mvilliger added a commit to eclipse-scout/scout.docs that referenced this issue Dec 2, 2022
This reverts commit ecf4d63.

Workaround no longer required because Jandex has been updated to 3.0.5
@mvilliger
Copy link
Author

I can confirm the issue is fixed 🎉👌

@Ladicek
Copy link
Contributor

Ladicek commented Dec 2, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants