Valid java 5 code refuses to compile with lambda-8-b81-linux-x64-12_mar_2013

Grégoire Neuville gregoire.neuville at
Sat Mar 16 16:17:33 PDT 2013


First of all, let me thank and congratulate you for the hard work you're
putting into adding a functional tone to java : this is a great move that
will undoubtedly prove itself immensely beneficial.

That being said, I'm having a hard time compiling some basic java 5 code
with the binary pre-release of both the bare jdk 1.8 and the
lambda-enriched one. Indeed, trying to compile the below code :


 public class TestJ8 {

    interface Func<A, B> {
        B f(A a);

    class List<A> {

        <B> List<B> map(Func<A, B> f) {
            return null;

        <B> List<B> bind(Func<A, List<B>> f) {
            return null;

        <B> List<B> apply(final List<Func<A, B>> lf) {
            return lf.bind(this::map);

        <B, C> List<C> bind(final List<B> lb, final Func<A, Func<B, C>> f) {
            return lb.apply(map(f)); // fails to compile




fails with the given message :  error: method apply in class TestJ8.List<A>
cannot be applied to given types

Is it expected behaviour or am I missing something (installation steps or
whatever...) ?

Note : The compiler is invoked through maven with the following
configuration :


Thanks !

Grégoire Neuville

More information about the lambda-dev mailing list