Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Active annotations interface default methods #1256

Closed
mepeisen opened this issue Nov 13, 2021 · 3 comments
Closed

Active annotations interface default methods #1256

mepeisen opened this issue Nov 13, 2021 · 3 comments
Labels

Comments

@mepeisen
Copy link

Having a very simple active annotation to add a default method to an interface it does not work.

Sample code from processor:
annotatedInterface.addMethod("getFoo", [ newMethod | { newMethod.returnType = Foo.newTypeReference newMethod.^default = true newMethod.body = '''return new Foo();''' }])

This will generate a method body but modifier "default" is missing. Expected result is generating a method body and including default modifier.

I am using a maven setup with java version 12 and with xtend 2.25.0 as well as xtend-maven-plugin 2.25.0.
Eclipse version is 2021-03 and installed xtext/xtend plugin version is 2.25.0. Jee plugin is version 4.19.0. M2e version is 1.17.2.

Looking at the sources it might not detect java version as greater of version 8? Within JvmModelGenerator in method "_generateModifier" it checks for java version 8. In eclipse preferences there is a hint at xtend compiler page. It says "take compatibility level from java settings. Seems it does not understand java 12. Setting this option to java 11 and recompiling works. So the main problem seems to be that xtend does not understand how to handle java 12 or greater from java settings/ maven pom settings.

@cdietrich
Copy link
Member

cdietrich commented Nov 14, 2021

xtend does not support Java 12 as runtime. you may try to explicitely use java 11 as runtime as a workaround

@Parameter(property="maven.compiler.source", defaultValue="1.6")

see also eclipse-xtext/xtext#1982

cdietrich added a commit that referenced this issue Nov 15, 2021
see #1256

Signed-off-by: Christian Dietrich <[email protected]>
@cdietrich
Copy link
Member

ping @mepeisen

@cdietrich
Copy link
Member

close as no further feedback from user

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants