diff --git a/distage/distage-core-api/src/main/scala/izumi/distage/model/reflection/universe/WithDISymbolInfo.scala b/distage/distage-core-api/src/main/scala/izumi/distage/model/reflection/universe/WithDISymbolInfo.scala index 16fd9a784d..db87ab80d5 100644 --- a/distage/distage-core-api/src/main/scala/izumi/distage/model/reflection/universe/WithDISymbolInfo.scala +++ b/distage/distage-core-api/src/main/scala/izumi/distage/model/reflection/universe/WithDISymbolInfo.scala @@ -85,7 +85,7 @@ trait WithDISymbolInfo { this: DIUniverseBase with WithDISafeType => SymbolInfo.Static( name = transformName(tpe.typeSymbol.name.toString), finalResultType = tpe, - annotations = AnnotationTools.getAllTypeAnnotations[u.type](tpe), + annotations = AnnotationTools.getAllTypeAnnotations(u)(tpe), isByName = tpe.typeSymbol.isClass && tpe.typeSymbol.asClass == u.definitions.ByNameParamClass, wasGeneric = tpe.typeSymbol.isParameter, ) diff --git a/fundamentals/fundamentals-reflection/src/main/scala/izumi/fundamentals/reflection/AnnotationTools.scala b/fundamentals/fundamentals-reflection/src/main/scala/izumi/fundamentals/reflection/AnnotationTools.scala index 6f5969dd8d..c0ff33b807 100644 --- a/fundamentals/fundamentals-reflection/src/main/scala/izumi/fundamentals/reflection/AnnotationTools.scala +++ b/fundamentals/fundamentals-reflection/src/main/scala/izumi/fundamentals/reflection/AnnotationTools.scala @@ -1,20 +1,25 @@ package izumi.fundamentals.reflection +import izumi.fundamentals.reflection.ReflectionUtil.stripByName + +import scala.annotation.nowarn import scala.reflect.api.Universe object AnnotationTools { def getAllAnnotations(u: Universe)(symb: u.Symbol): List[u.Annotation] = { - symb.annotations ++ getAllTypeAnnotations[u.type](symb.typeSignature) + symb.annotations ++ getAllTypeAnnotations(u)(symb.typeSignature) } - def getAllTypeAnnotations[U <: Universe with Singleton](typ: U#Type): List[U#Annotation] = { - typ.finalResultType.dealias match { - case t: U#AnnotatedTypeApi => + def getAllTypeAnnotations(u: Universe)(typ: u.Type): List[u.Annotation] = { + @nowarn("msg=outer reference") + val out = stripByName(u)(typ.finalResultType.dealias) match { + case t: u.AnnotatedTypeApi => t.annotations case _ => Nil } + out } def annotationTypeEq(u: Universe)(tpe: u.Type, ann: u.Annotation): Boolean = {