ReadyTalk / avian

[INACTIVE] Avian is a lightweight virtual machine and class library designed to provide a useful subset of Java's features, suitable for building self-contained applications.
https://readytalk.github.io/avian/
Other
1.22k stars 172 forks source link

Collectors.joining: don't know how to auto-unbox to V #557

Closed JonathanxD closed 6 years ago

JonathanxD commented 6 years ago

I was trying to run a project and it failed to launch, looking at stack trace, I found that Collectors.joining does not work (because Metafactory can't auto unbox to V).

import java.util.List;
import java.util.ArrayList;
import java.util.function.*;
import java.util.stream.*;

public class JoiningTest {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("A");
        list.add("B");
        list.stream().collect(Collectors.joining(", "));
    }
}

Run

/home/jonathan/avian/build/linux-x86_64-openjdk/avian-dynamic -cp . JoiningTest

Error:

java/lang/AssertionError: don't know how to auto-unbox to V
  at java/lang/invoke/LambdaMetafactory.maybeBoxOrUnbox (line 203)
  at java/lang/invoke/LambdaMetafactory.makeInvocationCode (line 353)
  at java/lang/invoke/LambdaMetafactory.makeLambda (line 470)
  at java/lang/invoke/LambdaMetafactory.metafactory (line 522)
  at java/util/stream/Collectors.joining (line 298)
  at java/util/stream/Collectors.joining (line 279)
  at JoiningTest.main (line 11)
dicej commented 6 years ago

Thanks for the report. This should fix it: https://github.com/ReadyTalk/avian/commit/49e39e8917e6f263c0c8fe542d7cd1b9ff8e4051