Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XbaseCompiler does not generate lambdas when running from xtext-maven-plugin
XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818325] Thu, 12 December 2019 15:19 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

my Xbase DSL is setup with Java 8 (in Eclipse projects and also in the POMs). When I run the DSL editor the XbaseCompiler generates Java lambdas from Xbase lambdas. But when I generate Java code for my DSL files using the xtext-maven-plugin the XbaseCompiler generates Java anonymous classes.

I think that's the involved code

	protected void _toJavaExpression(final XClosure closure, final ITreeAppendable b) {
		if (b.hasName(closure)) {
			b.trace(closure, false).append(getVarName(closure, b));
		} else {
			LightweightTypeReference type = getLightweightType(closure);
			JvmOperation operation = findImplementingOperation(type);
			if (operation != null) {
				GeneratorConfig config = b.getGeneratorConfig();
				if (config != null && config.getJavaSourceVersion().isAtLeast(JAVA8) && canCompileToJavaLambda(closure, type, operation)) {
					toLambda(closure, b.trace(closure, false), type, operation, true);
				} else {
					toAnonymousClass(closure, b.trace(closure, false), type, operation);
				}
			}
		}
	}


But is there a mechanism to further instruct the xtext-maven-plugin with that respect?

Thanks in advance
Lorenzo


Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818326 is a reply to message #1818325] Thu, 12 December 2019 15:22 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Maybe because of this? https://github.com/eclipse/xtext-maven/issues/11

Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818328 is a reply to message #1818326] Thu, 12 December 2019 15:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
yes

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818329 is a reply to message #1818328] Thu, 12 December 2019 15:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
=> maybe you can configure that on your side/ the generator config.
see also https://github.com/eclipse/xtext-extras/issues/113


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818331 is a reply to message #1818329] Thu, 12 December 2019 16:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
did you consider to change that default for your dsl?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818356 is a reply to message #1818331] Fri, 13 December 2019 10:07 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
You mean a custom OutputConfigurationProvider?

Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818360 is a reply to message #1818356] Fri, 13 December 2019 10:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no a custom generatorconfig(provider)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818365 is a reply to message #1818360] Fri, 13 December 2019 10:51 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
OK, thanks!
It was actually rather easy :) https://github.com/LorenzoBettini/edelta/pull/61/commits/39bb5048857daeb80671e289c498206450440a2a


Previous Topic:Reduce resource consumption in project indexing
Next Topic:Build a language server for DSL
Goto Forum:
  


Current Time: Thu Apr 18 13:52:38 GMT 2024

Powered by FUDForum. Page generated in 0.02384 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top