Scala 获得;涉及对象FieldSerializer的非法循环引用;使用注释时
我正在使用以下代码提取案例类属性的所有注释:Scala 获得;涉及对象FieldSerializer的非法循环引用;使用注释时,scala,annotations,Scala,Annotations,我正在使用以下代码提取案例类属性的所有注释: val allAnnotations = typeOf[T].typeSymbol.asClass.primaryConstructor .typeSignature.paramLists.head.map(_.annotations) 在我将此注释添加到案例类属性之一之前,一切正常: @(Tag@field) 例如: case class Test(@(Tag@field)(10) id1: Int, @M
val allAnnotations = typeOf[T].typeSymbol.asClass.primaryConstructor
.typeSignature.paramLists.head.map(_.annotations)
在我将此注释添加到案例类属性之一之前,一切正常:
@(Tag@field)
例如:
case class Test(@(Tag@field)(10) id1: Int,
@MyAnnotation(128) id2: String,
...)
我得到一个例外:
scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving object FieldSerializer
有什么解决方法吗?能否请您提供
MyAnnotation
、Tag
和field
的定义?能否请您提供MyAnnotation
、Tag
和field
的定义?