Yet another lambda problem
teras opened this issue · 0 comments
teras commented
Hello
I think I found another lambda problem
Let's consider this interface:
public interface MyFunction<T, R> {
R apply(T t);
default <V> MyFunction<T, V> andThen(MyFunction<? super R, ? extends V> after) {
return t -> after.apply(apply(t));
}
static <T> MyFunction<T, T> identity() {
return t -> t;
}
}When I try to call this:
System.out.println(MyFunction.identity().andThen(MyFunction.identity()).apply("* Test"));The application crashes at this point:
error: memory read failed for 0x1000fa000
#0 0x00000001000fa160 in 0x1000fa160 ()
#1 0x0000000101bd901a in test/base/Hello.<init>()V ()
#2 0x0000000101c9983d in (anonymous namespace)::local::invoke(vm::Thread*, vm::GcMethod*, (anonymous namespace)::local::ArgumentList*) at /Users/teras/avian/scripts/avian/src/compile.cpp:8548
#3 0x0000000101c829c7 in (anonymous namespace)::local::MyProcessor::invokeList(vm::Thread*, vm::GcMethod*, vm::GcObject*, bool, __va_list_tag*) at /Users/teras/avian/scripts/avian/src/compile.cpp:9189
#4 0x0000000101cc8d87 in (anonymous namespace)::local::callIntMethodV(vm::Thread*, unsigned long*) at /Users/teras/avian/scripts/avian/src/jnienv.cpp:707
#5 0x0000000101cee9ad in vmRun ()
...
Any idea what is wrong?