Skip to content

AOT processing fails with Set if type doesn't implement Comparable #29792

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

Closed
jvalkeal opened this issue Jan 10, 2023 · 0 comments
Closed

AOT processing fails with Set if type doesn't implement Comparable #29792

jvalkeal opened this issue Jan 10, 2023 · 0 comments
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@jvalkeal
Copy link
Contributor

Creating a bean definition manually and having Set containing types(Like Class) which doesn't implement Comparable fails in aot processing.

Sample code https://github.com/jvalkeal/spring-aot-issue-1

In sample I just picked Class as you can't add it to TreeSet which is where things fails within aot.

Caused by: java.lang.ClassCastException: class java.lang.Class cannot be cast to class java.lang.Comparable (java.lang.Class and java.lang.Comparable are in module java.base of loader 'bootstrap')
        at java.base/java.util.TreeMap.compare(TreeMap.java:1569)
        at java.base/java.util.TreeMap.addEntryToEmptyMap(TreeMap.java:776)
        at java.base/java.util.TreeMap.put(TreeMap.java:785)
        at java.base/java.util.TreeMap.put(TreeMap.java:534)
        at java.base/java.util.TreeSet.add(TreeSet.java:255)
        at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:336)
        at java.base/java.util.TreeSet.addAll(TreeSet.java:309)
        at java.base/java.util.TreeSet.<init>(TreeSet.java:160)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator$SetDelegate.orderForCodeConsistency(BeanDefinitionPropertyValueCodeGenerator.java:456)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 10, 2023
@sbrannen sbrannen added type: bug A general bug theme: aot An issue related to Ahead-of-time processing labels Jan 10, 2023
@sbrannen sbrannen added this to the Triage Queue milestone Jan 10, 2023
@sdeleuze sdeleuze self-assigned this Jan 17, 2023
@sdeleuze sdeleuze modified the milestones: Triage Queue, 6.0.5 Jan 17, 2023
@sdeleuze sdeleuze added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on type: bug A general bug labels Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants