[Active Annotation] How to set / unset the "override keyword" for a method?

54 views
Skip to first unread message

torsten.j...@gmail.com

unread,
Apr 23, 2013, 6:13:43 PM4/23/13
to xtend...@googlegroups.com
I'm working on an active annotation which generates a new class which is used as supertype for the annotated class.
The generated class contains methods which are already defined in the annotated class.
In the annotated class these (now overridden) methods don't have the override keyword.

Therefore the Xtend compiler is bailing out with the following error:

ERROR:The method foo of type bar must use override keyword since it actually overrides a supertype method.



Now I'm wondering how to set / unset the "override keyword" for an existing method in an annotated class.

/Torsten

Sven Efftinge

unread,
Apr 24, 2013, 1:24:59 AM4/24/13
to xtend...@googlegroups.com
You don't. You have to use 'override' instead of 'def' in the source code, since after your modification they are actually overriding methods.

Sven

torsten.j...@gmail.com

unread,
Apr 24, 2013, 5:51:13 AM4/24/13
to xtend...@googlegroups.com
But requiring the keyword "override" isn't obvious to the user because the corresponding class doesn't use the keyword "extends".
Instead the class is extended "under the hood" due to the annotation.

Isn't there any workaround here to trick Xtends validations? Maybe by adding (during the transformation process) the annotation @Override to the corresponding method.

/Torsten

Sven Efftinge

unread,
Apr 25, 2013, 9:45:09 AM4/25/13
to xtend...@googlegroups.com
No, there is no workaround.
Also all the IDE features will communicate to the user that there actually is a super class and a method declaration.
I think being transparent about that is a good idea.

--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages