[AA] Active Annotatin Not Applicable to Interfaces

25 views
Skip to first unread message

denis....@gmail.com

unread,
May 11, 2015, 6:03:46 PM5/11/15
to xtend...@googlegroups.com
Hi,
is my assumtpion right, that an Active Annotation is not applicable to Xtend interface types?
I tried, but got an Xtend compilation error:

Error
Mon May 11 23:30:51 CEST 2015
org.eclipse.xtext.builder.BuilderParticipant  - Error during compilation of 'platform:/resource/FlowDesignInXtend/src/de/grammarcraft/xtend/annotatedflow/IFlowUnitInterface.xtend'.

java.lang.ClassCastException: org.eclipse.xtend.core.macro.declaration.XtendInterfaceDeclarationImpl cannot be cast to org.eclipse.xtend.lib.macro.declaration.ClassDeclaration
    at org.eclipse.xtend.lib.macro.AbstractClassProcessor.doGenerateCode(AbstractClassProcessor.java:53)
    at org.eclipse.xtend.core.compiler.XtendGenerator.callMacroProcessors(XtendGenerator.java:134)
    at org.eclipse.xtend.core.compiler.XtendGenerator.doGenerate(XtendGenerator.java:95)
    at org.eclipse.xtend.ide.builder.XtendParallelBuilderParticipant.handleChangedContents(XtendParallelBuilderParticipant.java:70)
    at org.eclipse.xtext.builder.BuilderParticipant.doGenerate(BuilderParticipant.java:501)
    at org.eclipse.xtend.ide.builder.XtendParallelBuilderParticipant.access$3(XtendParallelBuilderParticipant.java:1)
    at org.eclipse.xtend.ide.builder.XtendParallelBuilderParticipant$1.run(XtendParallelBuilderParticipant.java:114)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Denis

Christian Dietrich

unread,
May 11, 2015, 11:56:33 PM5/11/15
to xtend...@googlegroups.com, denis....@gmail.com
i think that it what 

AbstractInterfaceProcessor is for

Sven Efftinge

unread,
May 12, 2015, 1:35:44 AM5/12/15
to xtend...@googlegroups.com
If you want a processor that works for all type declaration, you need to implement the various participant interfaces parameterized with TypeDeclaration.

On 12 May 2015, at 05:56, Christian Dietrich <christian.di...@googlemail.com> wrote:

i think that it what 

AbstractInterfaceProcessor is for


--
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/d/optout.

denis....@gmail.com

unread,
May 15, 2015, 3:20:27 PM5/15/15
to xtend...@googlegroups.com, efft...@itemis.de
Thanks both for the hints.

Sven, do you mean, to implement an AA applicable to interfaces and classes at the same time I would have to implement a class similar to the following signature:
public abstract class MyInterfaceAndClassProcessor implements RegisterGlobalsParticipant<TypeDeclaration>, TransformationParticipant<MutableTypeDeclaration>, CodeGenerationParticipant<TypeDeclaration>, ValidationParticipant<TypeDeclaration> { ... }

Does something like MutableTypeDeclaration exist?

Thanks, Denis

Sebastian Zarnekow

unread,
May 16, 2015, 7:59:26 AM5/16/15
to xtend...@googlegroups.com, Sven Efftinge
Yes, it's org.eclipse.xtend.lib.macro.declaration.MutableTypeDeclaration

The declaration of your InterfaceAndClassProcessor looks correct.

Best,
Sebastian
Reply all
Reply to author
Forward
0 new messages