Skip to main content



      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 10:19 Go to next message
Eclipse UserFriend
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 10:22 Go to previous messageGo to next message
Eclipse UserFriend
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 10:39 Go to previous messageGo to next message
Eclipse UserFriend
yes
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818329 is a reply to message #1818328] Thu, 12 December 2019 10:40 Go to previous messageGo to next message
Eclipse UserFriend
=> maybe you can configure that on your side/ the generator config.
see also https://github.com/eclipse/xtext-extras/issues/113
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818331 is a reply to message #1818329] Thu, 12 December 2019 11:03 Go to previous messageGo to next message
Eclipse UserFriend
did you consider to change that default for your dsl?
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818356 is a reply to message #1818331] Fri, 13 December 2019 05:07 Go to previous messageGo to next message
Eclipse UserFriend
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 05:23 Go to previous messageGo to next message
Eclipse UserFriend
no a custom generatorconfig(provider)
Re: XbaseCompiler does not generate lambdas when running from xtext-maven-plugin [message #1818365 is a reply to message #1818360] Fri, 13 December 2019 05:51 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 22:05:41 EDT 2025

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

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

Back to the top