javalang icon indicating copy to clipboard operation
javalang copied to clipboard

JavaSyntaxError when using Java 8's stream.toArray

Open BooNooNooNouS opened this issue 9 years ago • 2 comments

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);

BooNooNooNouS avatar Jan 22 '16 20:01 BooNooNooNouS

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?

shivshnkr avatar Jan 25 '16 18:01 shivshnkr

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 .

dbaxa avatar Feb 09 '16 23:02 dbaxa