javalang icon indicating copy to clipboard operation
javalang copied to clipboard

JavaSyntaxError parsing method reference

Open hacktoon opened this issue 7 years ago • 1 comments

The code below is throwing a JavaSyntaxError because of the brackets in "Long[]::new", and I can't figure out why. Is it invalid Java?

public class StatementStepDefinition {
    public void foobar() {
        final Long[] secondaryTransactionsIds = getSecondaryTransactions().stream().toArray(Long[]::new);
    }
}

hacktoon avatar Apr 23 '18 14:04 hacktoon

It is valid JDK8 Streams API syntax. I ran into this issue too, so will see if I can submit a PR to resolve it.

jsjohnst avatar Aug 24 '20 14:08 jsjohnst