javalang
javalang copied to clipboard
JavaSyntaxError when using Java 8's stream.toArray
When using Stream.toArray(), a JavaSyntaxError is raised because it doesn't understand how to parse the .toArray(Object[]::new) call.
example:
Person[] men = people.stream()
.filter(p -> p.getGender() == MALE)
.toArray(Person[]::new);
Even I am facing a similar issue. And there are other java 8 constructs which haven't been looked upon. Is there a scope of adding java 8 support to this super exciting project?
You could always open a pull request to add support for what you need.
I'll note that there is an existing test case that should cover this issue that we currently expect to fail at https://github.com/c2nes/javalang/blob/master/javalang/test/test_java_8_syntax.py#L198 .