Get/Set enum value on annotation with nested enumeration

52 views
Skip to first unread message

chrs wk

unread,
Feb 9, 2016, 1:45:06 PM2/9/16
to Xtend Programming Language
Hi

I would like to set the enum value of an annotation in my class processor by calling setEnumValue inside the builder of newAnnotationReference. After finally figuring out how to get hold of EnumerationValueDeclaration, I was met with an exception. Is there something obvious that I'm doing wrong?

JsonInclude is an annotation from Jackson Annotations and has a nested enumeration Include. This is what I tried (I want to use a different value than the default, but you get the idea):

val value = JsonInclude.newAnnotationReference.getEnumValue("value")
val includeAnnotation = JsonInclude.newAnnotationReference [
    setEnumValue("value", value)
]

This is the exception:

java.lang.IllegalArgumentException: com.fasterxml.jackson.annotation.JsonInclude.Include is not applicable at this location. Expected com.fasterxml.jackson.annotation.JsonInclude$Include
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
at org.eclipse.xtend.core.macro.ConditionUtils.checkTypeName(ConditionUtils.java:92)
at org.eclipse.xtend.core.macro.declaration.AnnotationReferenceBuildContextImpl.checkType(AnnotationReferenceBuildContextImpl.java:939)
at org.eclipse.xtend.core.macro.declaration.AnnotationReferenceBuildContextImpl._setValue(AnnotationReferenceBuildContextImpl.java:598)
at org.eclipse.xtend.core.macro.declaration.AnnotationReferenceBuildContextImpl.setValue(AnnotationReferenceBuildContextImpl.java:1125)
at org.eclipse.xtend.core.macro.declaration.AnnotationReferenceBuildContextImpl.setValues(AnnotationReferenceBuildContextImpl.java:418)
at org.eclipse.xtend.core.macro.declaration.AnnotationReferenceBuildContextImpl._internalSet(AnnotationReferenceBuildContextImpl.java:385)
at org.eclipse.xtend.core.macro.declaration.AnnotationReferenceBuildContextImpl.setEnumValue(AnnotationReferenceBuildContextImpl.java:216)


Thank you in advance for any help.

-Chris

Sven Efftinge (sven@efftinge.de)

unread,
Feb 9, 2016, 3:38:43 PM2/9/16
to xtend...@googlegroups.com
Hi Chris,

looks like a bug. 
Could you create a bugzilla and attach a reproduceable example?

thanks,
Sven

--
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.

chrs wk

unread,
Feb 10, 2016, 3:20:29 AM2/10/16
to Xtend Programming Language
Hey Sven

I'll do that! Thanks.

-Chris
Reply all
Reply to author
Forward
0 new messages