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: 1770
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: 1770
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: 13643
Registered: July 2009
Senior Member
yes

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
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: 13643
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


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
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: 13643
Registered: July 2009
Senior Member
did you consider to change that default for your dsl?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
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: 1770
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: 13643
Registered: July 2009
Senior Member
no a custom generatorconfig(provider)

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
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: 1770
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: Fri Oct 30 14:01:15 GMT 2020

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

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

Back to the top