We are using java generated entities with functional methods on entity collections like any
, select
, collect
…
They work fine in java but fail when trying to call them from Kotlin.
In java I can call
UmlgSet<? extends Group> groups = Group.allInstances();
Group g = groups.any( group -> true);
System.out.println(g.getName());
Trying to do the same from Kotlin fails.
val groups : UmlgSet<out Group> = Group.allInstances()
val group = groups.any({true})
println(group.name)
And the exception
java.lang.ClassCastException: com.digitata.netaggregate.aggregate.TestThis$test$group$1 cannot be cast to org.umlg.runtime.collection.ocl.BooleanExpressionEvaluator
at com.digitata.netaggregate.aggregate.TestThis.test(TestThis.kt:22)
The BooleanExpressionEvaluator looks like,
@FunctionalInterface
public interface BooleanExpressionEvaluator<E> extends BodyExpressionEvaluator<Boolean, E> {
@Override
Boolean evaluate(E e);
}
Any idea what is going wrong here. I tried to duplicate it with a simpler project but then it keeps on working.
Thanks