scala.reflect.runtime.ReflectError: value Predef is not a package
at scala.reflect.runtime.JavaMirrors$JavaMirror.scala$reflect$runtime$JavaMirrors$$makeScalaPackage(JavaMirrors.scala:912)
at scala.reflect.runtime.JavaMirrors$class.missingHook(JavaMirrors.scala:1296)
at scala.reflect.runtime.JavaUniverse.missingHook(JavaUniverse.scala:12)
at scala.reflect.internal.Mirrors$RootsBase.universeMissingHook(Mirrors.scala:77)
at scala.reflect.internal.Mirrors$RootsBase.missingHook(Mirrors.scala:79)
at scala.reflect.internal.pickling.UnPickler$Scan.readExtSymbol$1(UnPickler.scala:226)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbol(UnPickler.scala:250)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbolRef(UnPickler.scala:783)
at scala.reflect.internal.pickling.UnPickler$Scan.readExtSymbol$1(UnPickler.scala:200)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbol(UnPickler.scala:250)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbolRef(UnPickler.scala:783)
at scala.reflect.internal.pickling.UnPickler$Scan.readType(UnPickler.scala:346)
at scala.reflect.internal.pickling.UnPickler$Scan$LazyTypeRef$$anonfun$34.apply(UnPickler.scala:855)
at scala.reflect.internal.pickling.UnPickler$Scan$LazyTypeRef$$anonfun$34.apply(UnPickler.scala:855)
at scala.reflect.internal.pickling.UnPickler$Scan.at(UnPickler.scala:171)
at scala.reflect.internal.pickling.UnPickler$Scan$LazyTypeRef.complete(UnPickler.scala:855)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1229)
at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1365)
at scala.reflect.internal.Symbols$Symbol.annotations(Symbols.scala:1572)
at scala.reflect.internal.Symbols$Symbol.addAnnotation(Symbols.scala:1591)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbolAnnotation(UnPickler.scala:491)
at scala.reflect.internal.pickling.UnPickler$Scan.run(UnPickler.scala:88)
at scala.reflect.internal.pickling.UnPickler.unpickle(UnPickler.scala:37)
at scala.reflect.runtime.JavaMirrors$JavaMirror.unpickleClass(JavaMirrors.scala:565)
at scala.reflect.runtime.SymbolLoaders$TopClassCompleter.complete(SymbolLoaders.scala:32)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1229)
at scala.reflect.internal.Types$TypeRef.decls(Types.scala:2436)
at scala.reflect.internal.Types$Type.findDecl(Types.scala:1059)
at scala.reflect.internal.Types$Type.decl(Types.scala:646)
at scala.reflect.internal.Types$TypeApiImpl.declaration(Types.scala:299)
at scala.reflect.internal.Types$TypeApiImpl.declaration(Types.scala:298)
at no.officenet.origo.core.infrastructure.validation.OrigoValidator.resolveValue(OrigoValidator.scala:75)
OrigoValidator.resolveValue looks like this:
val mirror = currentMirror
override def resolveValue(ctx: FieldContext, validatedObject: scala.Any): AnyRef = {
val field: Field = ctx.getField
if (!field.isAccessible) {
field.setAccessible(true)
}
val c = field.getDeclaringClass
val classMirror = mirror.classSymbol(c)
val fieldType = mirror.classSymbol(field.getType).toType
val im = mirror.reflect(validatedObject)
(classMirror.toType.declaration(newTermName(field.getName)) match {
case ms: MethodSymbol => Some(ms)
case _ => None
}).filter(_.returnType == fieldType).map{m =>
val mm = im.reflectMethod(m)
mm.apply().asInstanceOf[AnyRef]
}.getOrElse(field.get(validatedObject))
}
Having this method synchronized will degrade performance a lot as it's part of validating-code in my domain-layer..
Any workarounds?
Thanks.