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)