Ceylon backend error: lambda expressions are not supported in -source 1.7

66 views
Skip to first unread message

Nicolas Corai

unread,
Sep 22, 2016, 3:26:14 PM9/22/16
to ceylon-users
When compiling a project that contains Java and Ceylon code, the Ceylon compiler trips on all the Java-8-specific code with the error messages like:
error: Ceylon backend error: lambda expressions are not supported in -source 1.7
       (use -source 8 or higher to enable lambda expressions)

That message is confusing. To me, the --source parameter is an alias to --src and I have found no obvious place to specify the Java level for the ceylon compiler, besides
import java.base "8";

Invoking 'ceylon compile -source 8 my.module' as suggested expectedly results in error message
ceylon compile: Invalid module name or source file: 8

What should I do?

Thanks,

- N -

Tako Schotanus

unread,
Sep 22, 2016, 7:04:23 PM9/22/16
to ceylon-users
Nicolai, are you sure you are working with a Java 8 compiler?
(Either by checking the project settings of your IDE or by typing `java -version` in the CLI)


-Tako

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/7c8d7559-76d7-4ae4-986b-543559a7de0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicolas Corai

unread,
Sep 22, 2016, 8:12:37 PM9/22/16
to ceylon-users, ta...@codejive.org
I haven't had Java 7 on my machine for a while now.

The project was created using Java 7 though, so maybe it's a buried setting that I can't find. Could you explain the -source option that the error messages are referring to?

BTW I'm getting the error both using ceylonb and within Eclipse.



On Thursday, September 22, 2016 at 4:04:23 PM UTC-7, Tako Schotanus wrote:
Nicolai, are you sure you are working with a Java 8 compiler?
(Either by checking the project settings of your IDE or by typing `java -version` in the CLI)


-Tako

On Thu, Sep 22, 2016 at 9:26 PM, Nicolas Corai <nicola...@gmail.com> wrote:
When compiling a project that contains Java and Ceylon code, the Ceylon compiler trips on all the Java-8-specific code with the error messages like:
error: Ceylon backend error: lambda expressions are not supported in -source 1.7
       (use -source 8 or higher to enable lambda expressions)

That message is confusing. To me, the --source parameter is an alias to --src and I have found no obvious place to specify the Java level for the ceylon compiler, besides
import java.base "8";

Invoking 'ceylon compile -source 8 my.module' as suggested expectedly results in error message
ceylon compile: Invalid module name or source file: 8

What should I do?

Thanks,

- N -

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.

Lucas Werkmeister

unread,
Sep 22, 2016, 8:17:09 PM9/22/16
to ceylon...@googlegroups.com

I can reproduce the problem without any Eclipse, just using ceylon compile. I think the problem might be that we always set our embedded javac to 1.7.

However, this works:

ceylon compile --javac='-source=1.8' --javac='-target=1.8' tmp

(Without the target flag, you get a nasty CompilerBugException.)

Nicolas Corai

unread,
Sep 22, 2016, 10:24:38 PM9/22/16
to ceylon-users
Thanks Lukas

I got it to work on the command line, although with a slightly different syntax: ceylonb compile --javac=-source=8 --javac=-target=8 my.module (maybe because I'm on Windows 10, using quotes would result in errors like Unknown --javac option: '-source)

In Eclipse, I modified the .ceylon/config to add the following two bolded lines, butthat didn't seem to help
[compiler]
source
=src
source
=test
resource
=resource
javac=-source=8
javac
=-target=8


Indeed, javac is not listed as a possible setting in https://ceylon-lang.org/documentation/1.3/reference/tool/config/#_compiler_section

Tako Schotanus

unread,
Sep 23, 2016, 6:50:25 AM9/23/16
to ceylon-users
Nicolas: I just added support for those `javac` options to the config file. But that will of course be for 1.3.1 so that won't help you much right now unfortunately.

But I wonder if we should try to do something more.
It seems to me that if you only have a Java 8 installed or if Java 8 is your currently active Java version then perhaps we should automatically choose the Java 8 source/target options?


-Tako

To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

Gavin King

unread,
Sep 23, 2016, 6:58:58 AM9/23/16
to ceylon...@googlegroups.com
On Fri, Sep 23, 2016 at 12:50 PM, Tako Schotanus <ta...@codejive.org> wrote:

> But I wonder if we should try to do something more.
> It seems to me that if you only have a Java 8 installed or if Java 8 is your
> currently active Java version then perhaps we should automatically choose
> the Java 8 source/target options?

Yes. We should.


--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Tako Schotanus

unread,
Sep 23, 2016, 7:52:16 AM9/23/16
to ceylon-users


-Tako

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

Stephane Epardaud

unread,
Sep 23, 2016, 8:14:05 AM9/23/16
to ceylon...@googlegroups.com
As indicated in the issue, it's not clear this is what we should do.


For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Bastien Jansen

unread,
Sep 23, 2016, 11:49:12 AM9/23/16
to ceylon-users
Nicolas, if you put those options in `.ceylon/ide-config` instead of `.ceylon/config`, they will be used by Eclipse, see this issue:



As others have pointed out, it will likely be moved back to `.ceylon/config` in the near future though.

Nicolas Corai

unread,
Sep 23, 2016, 7:20:20 PM9/23/16
to ceylon-users
Works great!

Out of curiosity, why the separate config file?
Reply all
Reply to author
Forward
0 new messages