ОК, я нашел решение. Я установил пользовательский MetadataProvider
, который подделывает аннотацию @Transient
для свойства bitmap$0
.
Установите пользовательский MetadataProvider
:
configuration.getReflectionManager.asInstanceOf[JavaReflectionManager].setMetadataProvider(new JavaMetadataProvider {
override def getAnnotationReader(annotatedElement: AnnotatedElement): AnnotationReader = {
if (annotatedElement.toString.endsWith("bitmap$0")) {
new TransientAnnotationReader(annotatedElement)
} else {
new JavaAnnotationReader(annotatedElement)
}
}
})
Включенные классы:
class JavaAnnotationReader(val element: AnnotatedElement) extends AnnotationReader {
override def getAnnotation[T <: Annotation](annotationType: Class[T]): T = element.getAnnotation(annotationType)
override def isAnnotationPresent[T <: Annotation](annotationType: Class[T]): Boolean = element.isAnnotationPresent(annotationType)
override def getAnnotations: Array[Annotation] = element.getAnnotations
}
class TransientAnnotationReader(val element: AnnotatedElement) extends AnnotationReader {
override def getAnnotation[T <: Annotation](annotationType: Class[T]): T = element.getAnnotation(annotationType)
override def isAnnotationPresent[T <: Annotation](annotationType: Class[T]): Boolean = annotationType == classOf[Transient]
override def getAnnotations: Array[Annotation] = element.getAnnotations
}