Get/Set enum value on annotation with nested enumeration

已查看 52 次
跳至第一个未读帖子

chrs wk

未读,
2016年2月9日 13:45:062016/2/9
收件人 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)

未读,
2016年2月9日 15:38:432016/2/9
收件人 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

未读,
2016年2月10日 03:20:292016/2/10
收件人 Xtend Programming Language
Hey Sven

I'll do that! Thanks.

-Chris
回复全部
回复作者
转发
0 个新帖子