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

Yet another lambda problem #563

Open
teras opened this issue Jul 11, 2018 · 0 comments
Open

Yet another lambda problem #563

teras opened this issue Jul 11, 2018 · 0 comments

Comments

@teras
Copy link
Contributor

teras commented Jul 11, 2018

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?

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

No branches or pull requests

1 participant