c2nes / javalang

Pure Python Java parser and tools
MIT License
736 stars 161 forks source link

JavaSyntaxError when using Java 8's stream.toArray #21

Open BooNooNooNouS opened 8 years ago

BooNooNooNouS commented 8 years ago

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);
shivshnkr commented 8 years ago

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?

dbaxa commented 8 years ago

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 .